A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by FSA » Fri Oct 11, 2013 11:47 am
Hi!
I want to use NewtonWorldRayCast to check for ray-body collision. But I only want to check the collision for three bodies which are created by my own. Other bodies should have no collision. How is that possible?
-

FSA
-
- Posts: 322
- Joined: Wed Dec 21, 2011 9:47 am
by Julio Jerez » Fri Oct 11, 2013 12:24 pm
The ray cast call back report the body to the hit body and the sub shape that was hit, all you need to do is,
-Save some data with the object that you save in the user data that is attached to the collision shape, of to the sub collision shape if it is part of a sub collision, if is a compound collision
in the ray callback
-Get the userdata from the hit shape.
-cast that user data to your game object type
-Check if the Tree,
-if it is, you can save that object and the hit information in some array, that you pass as the user data of the ray cast.
I subject that if you are making some king of forest of tree, that you make the a single scene collision body, and tree a compound shape that you add to the scene
it save lot of memory, and increases performances geopmetrcially as the numbe of shape are added. because the cost remain essentially constant in the braodphase, an only work is done when that part is part of eth solution.
as oppose to making each tree a body, that add lot of work to the broaphase, and the low level collision system as well.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FSA » Sat Oct 12, 2013 5:50 am
Okay thank you!
Another quetsion: How can I turn off the collision for a NewtonBody at runtime and turn it back on?
-

FSA
-
- Posts: 322
- Joined: Wed Dec 21, 2011 9:47 am
by JoeJ » Sat Oct 12, 2013 7:24 am
-

JoeJ
-
- Posts: 1489
- Joined: Tue Dec 21, 2010 6:18 pm
by FSA » Sat Oct 12, 2013 12:30 pm
Does raycast work when I return zero from NewtonOnAABBOverlap callback?
-

FSA
-
- Posts: 322
- Joined: Wed Dec 21, 2011 9:47 am
by Julio Jerez » Sat Oct 12, 2013 12:47 pm
I do no understand NewtonOnAABBOverlap is call for the solver, it is no related to Raycast in anyway.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FSA » Sat Oct 12, 2013 12:48 pm
Yes sorry my fault

Can Julio maybe make a small material-demo for core300?
-

FSA
-
- Posts: 322
- Joined: Wed Dec 21, 2011 9:47 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest