[Request] Collision Filtering Support from Blender

View previous topic View next topic Go down

[Request] Collision Filtering Support from Blender

Post  uprise78 on Fri May 08, 2009 10:46 am

Bullet has built in support for collision with filtering the simplest and fastest being masks. It is a perfect fit for the iPhone to keep the performance at peak. If there was some way to specify the collision type and what it can collide with in Blender that would be superb. I am not sure what the best way to do this would be so I was hoping you had some ideas. Maybe something in the user variables that would make sense...

The only code change that would need is in sio2_physic.cc line 364. it would just need to pass 2 extra parameters to the Bullet addRigidBody method:
Code:

// Current way
_SIO2physic->_btSoftRigidDynamicsWorld->addRigidBody( _SIO2object->_btRigidBody );

to:
Code:

enum collisionTypes {
    COL_NOTHING  = 1<< 0,    //Collide with nothing
    COL_SHIP        = 1<< 1,    //Collide with ships
    COL_WALL        = 1<< 2,    //Collide with walls
    COL_POWERUP  = 1<< 3    //Collide with powerups
}
 
int objectCollidesWith = COL_SHIP | COL_WALL;

_SIO2physic->_btSoftRigidDynamicsWorld->addRigidBody( _SIO2object->_btRigidBody,
                                                                                      COL_SHIP /* collsion type of this object */,
                                                                                      objectCollidesWith /* bitmask of collisionTypes that this object should collide with */ );

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  Francescu on Fri May 08, 2009 3:11 pm

+1

I have been looking at this as well as I had wanted filter collisions thru collisions masks...you approach is exactly the one I was envisioning. Would be great to have it natively implemented as part of SIO2...

Cheers

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  sio2interactive on Fri May 08, 2009 5:13 pm

Ok sounds like a good idea but what is the workflow that you envision to integrate that within blender?

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  uprise78 on Fri May 08, 2009 5:24 pm

Let me poke around in Blender a bit to see what makes the most sense. It would be nice if everything could be done from withing Blender.

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  sio2interactive on Fri May 08, 2009 5:26 pm

I agree... but honestly at the moment I can't see where it can fit in...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  uprise78 on Fri May 08, 2009 6:03 pm

How 2 about user variables in Blender.

CollisionObjectType - This could be an integer that can pretty easily be mapped to a bitmask to be sent off to Bullet
ObjectCollidesWith - comma delimited list of integers that correspond to CollisionObjectTypes. On parsing, they can be added to the bitmask that gets sent to Blender.


I cant see any Blender built in controls that would work for this so user variables seem like the way to go. It would be pretty trivial to add the two variables for any objects that you want to be included with the collision masks.

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  sio2interactive on Fri May 08, 2009 6:05 pm

Allright i'll think about it...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: [Request] Collision Filtering Support from Blender

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum