Bullet Convex sweep test API #34989

Closed
opened 2013-04-15 02:45:11 +02:00 by Vilem Duha · 7 comments
Member

%%%1.This patch exposes a function from the bullet API: ConvexSweepTest(). It returns first hit object position, hitpoint, hit normal.
It was implemented to enable bullet collision testing from Python.
It is formulated as closely as possible as object.ray_cast() function, which is allready there, but this function is able to test any convex rigidbody against the whole RigidBodyWorld.

Because the simulation needs to be run or updated before tests can be performed, there is also a new function rigidbody_world.update() which calls the update simulation function from Python. This function has to be run just once.

If the simulation is not initialized, the convex_sweep_test() function returns an error.

I tested the patch quite a lot and didn't find any problems so far.

I have implemented the patch for better collision detection in the CAM addon which I am developing( http://blendercam.blogspot.cz/ ) , but I hope this could potentially be usefull to many python scripters.

%%%

%%%1.This patch exposes a function from the bullet API: ConvexSweepTest(). It returns first hit object position, hitpoint, hit normal. It was implemented to enable bullet collision testing from Python. It is formulated as closely as possible as object.ray_cast() function, which is allready there, but this function is able to test any convex rigidbody against the whole RigidBodyWorld. Because the simulation needs to be run or updated before tests can be performed, there is also a new function rigidbody_world.update() which calls the update simulation function from Python. This function has to be run just once. If the simulation is not initialized, the convex_sweep_test() function returns an error. I tested the patch quite a lot and didn't find any problems so far. I have implemented the patch for better collision detection in the CAM addon which I am developing( http://blendercam.blogspot.cz/ ) , but I hope this could potentially be usefull to many python scripters. %%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

%%%Uploaded a test file:
http://www.pasteall.org/blend/20770%%%

%%%Uploaded a test file: http://www.pasteall.org/blend/20770%%%

%%%Hey, sorry I didn't notice this earlier.
Usually it's best to ping people via irc or email after adding patches to the tracker, otherwise they might be overlooked :)

I'll try to look at it over the weekend.%%%

%%%Hey, sorry I didn't notice this earlier. Usually it's best to ping people via irc or email after adding patches to the tracker, otherwise they might be overlooked :) I'll try to look at it over the weekend.%%%

%%%Actually never mind, just missed your mail :)%%%

%%%Actually never mind, just missed your mail :)%%%
Author
Member

%%%I uploaded a newer patch - sweep08.patch - it updates some tooltips, and corrects the return value of the has_hit parameter of the api function - now it returns 1 in case of a hit, 0 in case of no hit.
Also now throws an error if a non convex shape is passed to the function since otherwise it would return no hits and the user's couldn't know why.
Still didn't resolve how to access scene data from the rigidbodyworld data. - that's why to the update function the scene has to be passed.%%%

%%%I uploaded a newer patch - sweep08.patch - it updates some tooltips, and corrects the return value of the has_hit parameter of the api function - now it returns 1 in case of a hit, 0 in case of no hit. Also now throws an error if a non convex shape is passed to the function since otherwise it would return no hits and the user's couldn't know why. Still didn't resolve how to access scene data from the rigidbodyworld data. - that's why to the update function the scene has to be passed.%%%

%%%Applied in svn r56195.%%%

%%%Applied in svn r56195.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#34989
No description provided.