Will freezed body be raycasted?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Will freezed body be raycasted?

Postby Rodion Karimov » Sat Aug 21, 2010 12:42 pm

Hello. I need an object, that will not interact physically with other objects, but will be raycasted by function NewtonWorldRayCast.

So if I create body with some collision primitive than freeze it by NewtonWorldFreezeBody - will it be then raycasted by NewtonWorldRayCast?

I use Newton 1.53.
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia

Re: Will freezed body be raycasted?

Postby Julio Jerez » Sat Aug 21, 2010 12:53 pm

yes.
but you should use 2.00
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Will freezed body be raycasted?

Postby Rodion Karimov » Sat Aug 21, 2010 1:45 pm

But will it work in 1.53?
2.x I will use in my next games. I familiar with 1.53, so I'll use it in current - for not to search information about the changes in 2.x now.
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia

Re: Will freezed body be raycasted?

Postby Julio Jerez » Sat Aug 21, 2010 2:40 pm

yes.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Will freezed body be raycasted?

Postby Rodion Karimov » Sun Aug 22, 2010 6:10 am

Ok, thank you.

One note - I downloaded Newton SDK 2.23 and there is no any documentation - even simple list of functions, as in 1.53. I think at least this list will be very helpful. Wiki is good, but it is online and if there is need to quickly learn information about some function - it is not very convenient to connect to internet, navigate wiki and search information about function.

But anyway - thanks for good physics engine.

And I found some bugs on site - in download section - dates of two new releases are - 07/05/2210 and 08/01/2210. The year is 200 years ahead :-) .
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia

Re: Will freezed body be raycasted?

Postby Stucuk » Sun Aug 22, 2010 8:20 am

The Wiki is the documentation. There is no Offline Documentation as it would easily become outdated. The Wiki on the other hand can be updated by the community as Newton Develops. Can't you just stay connected to the Internet(My Router is generally connected 24/7)?
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Will freezed body be raycasted?

Postby Rodion Karimov » Sun Aug 22, 2010 8:47 am

It is just a suggestion. But if it is not convenient to NGD developers - OK, I'll not argue.
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia

Re: Will freezed body be raycasted?

Postby Rodion Karimov » Fri Oct 08, 2010 3:39 am

Strangely - frozen bodies are still interacting.

I create them so -

Code: Select all
WriteOffsetMatrix ( OffsetMatrix, GameEngine.OWithFT [ i ].Size.y );

      case GameEngine.OWithFT [ i ].DescriptionType of
        PE_DT_SPHERE : Collision        := NewtonCreateSphere ( NewtonWorld, GameEngine.OWithFT [ i ].Size.x, GameEngine.OWithFT [ i ].Size.y, GameEngine.OWithFT [ i ].Size.z, @ OffsetMatrix );
        PE_DT_CYLINDER : Collision      := NewtonCreateCylinder ( NewtonWorld, GameEngine.OWithFT [ i ].Size.x, GameEngine.OWithFT [ i ].Size.y, @ OffsetMatrix );
        PE_DT_BOX : Collision           := NewtonCreateBox ( NewtonWorld, GameEngine.OWithFT [ i ].Size.x, GameEngine.OWithFT [ i ].Size.y, GameEngine.OWithFT [ i ].Size.z, @ OffsetMatrix );

      end; //-case

      GameEngine.OWithFT [ i ].NewtonBody   := NewtonCreateBody ( NewtonWorld, Collision );
      NewtonReleaseCollision ( NewtonWorld, Collision );

      //if GameEngine.OWithFT [ i ].Flags and OF_NOT_INTERACTING > 0 then begin
        NewtonBodySetAutoFreeze ( GameEngine.OWithFT [ i ].NewtonBody, 0 );
        NewtonWorldFreezeBody ( NewtonWorld, GameEngine.OWithFT [ i ].NewtonBody );

      //end;

      NewtonBodySetMassMatrix ( GameEngine.OWithFT [ i ].NewtonBody, GameEngine.OWithFT [ i ].Mass,
                                0.2 * GameEngine.OWithFT [ i ].Mass * ( GameEngine.OWithFT [ i ].Size.y * GameEngine.OWithFT [ i ].Size.y + GameEngine.OWithFT [ i ].Size.x * GameEngine.OWithFT [ i ].Size.x ),
                                0.2 * GameEngine.OWithFT [ i ].Mass * ( GameEngine.OWithFT [ i ].Size.z * GameEngine.OWithFT [ i ].Size.z + GameEngine.OWithFT [ i ].Size.x * GameEngine.OWithFT [ i ].Size.x ),
                                0.2 * GameEngine.OWithFT [ i ].Mass * ( GameEngine.OWithFT [ i ].Size.z * GameEngine.OWithFT [ i ].Size.z + GameEngine.OWithFT [ i ].Size.y * GameEngine.OWithFT [ i ].Size.y ) );

      if GameEngine.OWithFT [ i ].Mass <> 0.0 then
        NewtonBodySetForceAndTorqueCallBack ( GameEngine.OWithFT [ i ].NewtonBody, ForceAndTorqueCallBack );



    NewtonBodyGetMatrix ( GameEngine.OWithFT [ i ].NewtonBody, @ GameEngine.OWithFT [ i ].Matrix );
    WriteRotYMatrix ( GameEngine.OWithFT [ i ].Matrix, GameEngine.OWithFT [ i ].Rotation.y );
    WriteCoordinatesInPhysicsMatrix ( GameEngine.OWithFT [ i ].Matrix, GameEngine.OWithFT [ i ].Coordinates );
    NewtonBodySetMatrix ( GameEngine.OWithFT [ i ].NewtonBody, @ GameEngine.OWithFT [ i ].Matrix );
   
    SelectionEngine.SelectionDataArray [ j ].SType               := ST_OBJECT;
    SelectionEngine.SelectionDataArray [ j ].O                   := @ GameEngine.OWithFT [ i ];
    NewtonBodySetUserData ( GameEngine.OWithFT [ i ].NewtonBody, @ SelectionEngine.SelectionDataArray [ j ] );
    j                                   := j + 1;


They are raycasted, but they still interact with player, created like in Character Controller example. Maybe I'm making something wrong? Any suggestions will be very appreciated. I use Delphi headers with Free Pascal if it matters.
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia

Re: Will freezed body be raycasted?

Postby Rodion Karimov » Fri Oct 08, 2010 3:59 am

I've found some solution - I've set for these bodies - non collidable material. And everything works. Maybe it is not the best solution, but it works.
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia

Re: Will freezed body be raycasted?

Postby JernejL » Fri Oct 08, 2010 6:42 am

Ofcourse a frozen body will be raycast and will interact if something hits it. It's common functionality. Freezing a body does not equal to removing it from the newton world..
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Will freezed body be raycasted?

Postby Rodion Karimov » Sat Oct 09, 2010 12:35 am

Strange behavior - logically

NewtonBodySetAutoFreeze ( GameEngine.OWithFT [ i ].NewtonBody, 0 );

must disable autoactivation of the body. And

NewtonWorldFreezeBody ( NewtonWorld, GameEngine.OWithFT [ i ].NewtonBody );

must deactivate it. But anyway - solution is found and it works. And it is good.
Rodion Karimov
 
Posts: 13
Joined: Sat Jul 04, 2009 6:46 am
Location: Russia


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron