Physic object
2 posters
Physic object
You implement use of the camera as a _btRigidBody in Tutorial06.
My question: Do I implement a mesh object the same way. In my example scene I have only one object I need to get a physic handle on so that I can run bullet API on it.
I'm confused a little bit about using the lines of code in the 06 template on an object instead of my camera (don't need a collision object camera). I see ...AddCamera and physic properties being set.
How would I get a handle on a specific mesh in my scene so that I can manually apply a bullet API force to it?
edit: I guess I just having trouble getting a pointer...?
edit2: Check that, got the pointer methods from tutorial02 object/Suzanne...Now I will try to add physics object
edit3: app crashing on:_SIO2physic->_btDiscreteDynamicsWorld->addRigidBody( _btRigidBody );
edit4: I finally got the scene to render, by making sure to initialize the "good physic world" in the EAGLView class file. Now, the program runs and my scene renders, but my mesh that I believe I have added to the physic world does not appear!
edit5: Good news, slow but sure. Now I am able to play physics and have a sphere object fall with gravity. However, due to the quality of the youtube resolution, I am unable to create another object (cube acting as the "floor") and have collision object with my sphere.
edit6: I added a dupilcate cube "floor" object and set it as simply "actor" and "ghost" I translated just a bit and CTRL+A. Now my physics mesh collides with the floor object.
My last questions:
1. Issue: When I use the "floor" object as Actor->Ghost the collision works with only gravity, however when I use: _SIO2object->_btRigidBody->setLinearVelocity(btVector3 (-1,1,1)); right before PLAY, the object passes right through!
2. I have a concave mesh object that I would like to collide with the mesh as well (in addition to the "floor" object). Is there a way to make a concave collision object? Like a baseball going into a mitt? mitt is concave mesh? The additional objects I'd like my actor mesh to interact with don't seem to be working as colliders. The sphere passes right through.
Any suggestion on the next step? Thanks in advance
I can't seem to get a real grasp on the physic world concepts. Any tips would be greatly appreciated!!
My question: Do I implement a mesh object the same way. In my example scene I have only one object I need to get a physic handle on so that I can run bullet API on it.
I'm confused a little bit about using the lines of code in the 06 template on an object instead of my camera (don't need a collision object camera). I see ...AddCamera and physic properties being set.
How would I get a handle on a specific mesh in my scene so that I can manually apply a bullet API force to it?
edit: I guess I just having trouble getting a pointer...?
edit2: Check that, got the pointer methods from tutorial02 object/Suzanne...Now I will try to add physics object
edit3: app crashing on:_SIO2physic->_btDiscreteDynamicsWorld->addRigidBody( _btRigidBody );
edit4: I finally got the scene to render, by making sure to initialize the "good physic world" in the EAGLView class file. Now, the program runs and my scene renders, but my mesh that I believe I have added to the physic world does not appear!
edit5: Good news, slow but sure. Now I am able to play physics and have a sphere object fall with gravity. However, due to the quality of the youtube resolution, I am unable to create another object (cube acting as the "floor") and have collision object with my sphere.
edit6: I added a dupilcate cube "floor" object and set it as simply "actor" and "ghost" I translated just a bit and CTRL+A. Now my physics mesh collides with the floor object.
My last questions:
1. Issue: When I use the "floor" object as Actor->Ghost the collision works with only gravity, however when I use: _SIO2object->_btRigidBody->setLinearVelocity(btVector3 (-1,1,1)); right before PLAY, the object passes right through!
2. I have a concave mesh object that I would like to collide with the mesh as well (in addition to the "floor" object). Is there a way to make a concave collision object? Like a baseball going into a mitt? mitt is concave mesh? The additional objects I'd like my actor mesh to interact with don't seem to be working as colliders. The sphere passes right through.
Any suggestion on the next step? Thanks in advance
I can't seem to get a real grasp on the physic world concepts. Any tips would be greatly appreciated!!
jj- Posts : 77
Join date : 2008-09-24
Re: Physic object
Of course you can add physic object manually but it is a little complex to do, due to the sequence used in the creation process. I would really suggest you to use Bullet in order to manipulate the physic objects.
Concerning the youtube tutorial make sure that you add &fmt=18 at the end of the URL, this will playback the video in the highest quality youtube can give you. Maybe it'll make things more clear?
ex: https://www.youtube.com/watch?v=P9F7CyTjt78&fmt=18
Please review the tutorial06 (the code) as well as the 2 videos.
1. Issue: When I use the "floor" object as Actor->Ghost the collision works with only gravity, however when I use: _SIO2object->_btRigidBody->setLinearVelocity(btVector3 (-1,1,1)); right before PLAY, the object passes right through!
>> Please review tutorial06 for that one:
// This is basically a hack, when the execution pointer reach
// here we just finish loading so basically the frame rate is low. We
// are tweaking it a little to don't have bullet going to crazy
// and steping into the simulation with a delta time of 1 or something...
sio2->_SIO2window->fps = 15;
2. I have a concave mesh object that I would like to collide with the mesh as well (in addition to the "floor" object). Is there a way to make a concave collision object? Like a baseball going into a mitt? mitt is concave mesh? The additional objects I'd like my actor mesh to interact with don't seem to be working as colliders. The sphere passes right through.
>> Set the object bound type to Convex Hull Polytope
Concerning the youtube tutorial make sure that you add &fmt=18 at the end of the URL, this will playback the video in the highest quality youtube can give you. Maybe it'll make things more clear?
ex: https://www.youtube.com/watch?v=P9F7CyTjt78&fmt=18
Please review the tutorial06 (the code) as well as the 2 videos.
1. Issue: When I use the "floor" object as Actor->Ghost the collision works with only gravity, however when I use: _SIO2object->_btRigidBody->setLinearVelocity(btVector3 (-1,1,1)); right before PLAY, the object passes right through!
>> Please review tutorial06 for that one:
// This is basically a hack, when the execution pointer reach
// here we just finish loading so basically the frame rate is low. We
// are tweaking it a little to don't have bullet going to crazy
// and steping into the simulation with a delta time of 1 or something...
sio2->_SIO2window->fps = 15;
2. I have a concave mesh object that I would like to collide with the mesh as well (in addition to the "floor" object). Is there a way to make a concave collision object? Like a baseball going into a mitt? mitt is concave mesh? The additional objects I'd like my actor mesh to interact with don't seem to be working as colliders. The sphere passes right through.
>> Set the object bound type to Convex Hull Polytope
Re: Physic object
Thanks for the reply. I'm checking out the notes you sent
One thing I'm noticing: When I build & go the first time after export, collisions seem to be working. A couple times I exit out and restart app, it works as well. However, on the 2nd or 3rd time I exit and start app, the sphere is falling straight through!... Could this be a bug? Or, do I need to make use somehow of sio2PhysicReset ? Odd thing...
One thing I'm noticing: When I build & go the first time after export, collisions seem to be working. A couple times I exit out and restart app, it works as well. However, on the 2nd or 3rd time I exit and start app, the sphere is falling straight through!... Could this be a bug? Or, do I need to make use somehow of sio2PhysicReset ? Odd thing...
jj- Posts : 77
Join date : 2008-09-24
Re: Physic object
Im not exactly sure what is the problem his, what you can do is send the test project that cause problem and I can have a quick look, fix it then sent it back to you. How does this sound? Cuz honestly from your explanation I simply can't draw any sure conclusion how what may be the problem, sorry... but one thing that you need to understand is: In order to speed up the rendering im synchronizing the bullet frame based on the FPS and not the "pure" delta time of the app. its a little hack that make a huge difference when running on an iPhone, cuz the physic is actually the most time consuming processing of SIO2.
Cheers!
Cheers!
Re: Physic object
This sounds good, I'm going to futz around a little more, and then if I'm still having buggy behavior I can send you scene file.
I'm going to muddle through Bullet SDK 2.71 a bit to see if I can glean any additional knowledge into my current settings, perhaps something is off a bit. Any suggestion on the best resource for absolute n00b Bullet Physics API Library?
I'll post a few findings tomorrow. Thanks!
I'm going to muddle through Bullet SDK 2.71 a bit to see if I can glean any additional knowledge into my current settings, perhaps something is off a bit. Any suggestion on the best resource for absolute n00b Bullet Physics API Library?
I'll post a few findings tomorrow. Thanks!
jj- Posts : 77
Join date : 2008-09-24
Quick Question re: Rendering
Here is what I discovered. I had a Sphere object with a tiny dimension (.127) and see that it is recommended as having no colliders less then .2. I am scaling the world, and hopefully this will help the simulation.
edit: This appears to be the main culprit. However, I have a quick question re: Rendering. I have a solid object with 2 vertex groups. Materials are simply diffuse colors (red, blue). When my camera is close to these objects, rendering is ok. However, if I move the camera to a distance... I see through the outside solid material (some artifacts, pixelated) and see some "shimmering" of the vertex group (blue) on the inside of the concave mesh (convex hull polytope)... Have you seen this issue before? Is there a setting wrong (lighting, normals), or ? This issue is first priority, the issue in edit2 might not become a big deal. I just see that the rendering is off, and I can see the outline of the inside hull "through" the outside material. Artifacty... Could it simply be antiAliasing setting?? I'm not sure where I could affect this change...
edit2: Also, when my dynamic object interacts with this convex hull polytope mesh, the outside radius of the ball "pokes through" that mesh... odd. I am looking at the BSPDemo in the bullet SDK and examining the "method to remove the gap introduced by the 'collision margin'"
edit1B: I found this link. http://www.zeuscmd.com/tutorials/opengl/15-PolygonOffset.php
I believe I am seeing the effects of Z-fighting. Will look into this tutorial of using POLYGON OFFSET and will look through sio2 docs to see if this offset is implemented anywhere....From everything I've read, it appears I need to either A) set the zNear clipping plane of the frustum to a value a little larger than 0.1f... B)perform a polygon offset... How would I go about doing that?
edit3: FOUND IT! It appears you changed zNear and zFar to cstart, cend respectively. I am updating those values and experimenting... Will post findings here.
edit: This appears to be the main culprit. However, I have a quick question re: Rendering. I have a solid object with 2 vertex groups. Materials are simply diffuse colors (red, blue). When my camera is close to these objects, rendering is ok. However, if I move the camera to a distance... I see through the outside solid material (some artifacts, pixelated) and see some "shimmering" of the vertex group (blue) on the inside of the concave mesh (convex hull polytope)... Have you seen this issue before? Is there a setting wrong (lighting, normals), or ? This issue is first priority, the issue in edit2 might not become a big deal. I just see that the rendering is off, and I can see the outline of the inside hull "through" the outside material. Artifacty... Could it simply be antiAliasing setting?? I'm not sure where I could affect this change...
edit2: Also, when my dynamic object interacts with this convex hull polytope mesh, the outside radius of the ball "pokes through" that mesh... odd. I am looking at the BSPDemo in the bullet SDK and examining the "method to remove the gap introduced by the 'collision margin'"
edit1B: I found this link. http://www.zeuscmd.com/tutorials/opengl/15-PolygonOffset.php
I believe I am seeing the effects of Z-fighting. Will look into this tutorial of using POLYGON OFFSET and will look through sio2 docs to see if this offset is implemented anywhere....From everything I've read, it appears I need to either A) set the zNear clipping plane of the frustum to a value a little larger than 0.1f... B)perform a polygon offset... How would I go about doing that?
edit3: FOUND IT! It appears you changed zNear and zFar to cstart, cend respectively. I am updating those values and experimenting... Will post findings here.
jj- Posts : 77
Join date : 2008-09-24
Rendering OK
Rending is ok with changing cstart, cend. !
My next question: From everything I've read, both the object and the object's material can have dynamic physics attributes that include: damping, rotDamping, restitution, and friction. All of these can control the "bounciness" of the objects when they collide.
It appears I can 'setFriction', 'setRestitution', likewise damping, rotDamping: for a dynamic object _btRigidBody. However, I have two issues:
A) it appears I can only create static (unmoving, unaffected by gravity) mesh collision bodies by flagging the "actor-ghost" settings on the object logic in blender. If I mark a mesh "Actor-Dynamic" it is by default affected by gravity?
If I want to have an unmoving collision shape, must I duplicate the object and flag it as ghost? I understand only the vertex data is used for collision, but in that case am I able to set the friction and restitution of this "floor" object in order to control the behavior when the dynamic object "bounces" off of it?
B) it appears that when a material is applied in blender, this material has its own dynamic properties of damping, friction and restitution and that these properties OVERRIDE the object mesh actor properties. Is this correct? More appropriately, am I able to affect the values of these properties of materials being applied with BindAllMaterials.
In essence, can the sio2 engine support the control of "bounciness" when to collision objects collide? and what is the best implementation method.
Thanks in advance! Almost there!!
My next question: From everything I've read, both the object and the object's material can have dynamic physics attributes that include: damping, rotDamping, restitution, and friction. All of these can control the "bounciness" of the objects when they collide.
It appears I can 'setFriction', 'setRestitution', likewise damping, rotDamping: for a dynamic object _btRigidBody. However, I have two issues:
A) it appears I can only create static (unmoving, unaffected by gravity) mesh collision bodies by flagging the "actor-ghost" settings on the object logic in blender. If I mark a mesh "Actor-Dynamic" it is by default affected by gravity?
If I want to have an unmoving collision shape, must I duplicate the object and flag it as ghost? I understand only the vertex data is used for collision, but in that case am I able to set the friction and restitution of this "floor" object in order to control the behavior when the dynamic object "bounces" off of it?
B) it appears that when a material is applied in blender, this material has its own dynamic properties of damping, friction and restitution and that these properties OVERRIDE the object mesh actor properties. Is this correct? More appropriately, am I able to affect the values of these properties of materials being applied with BindAllMaterials.
In essence, can the sio2 engine support the control of "bounciness" when to collision objects collide? and what is the best implementation method.
Thanks in advance! Almost there!!
jj- Posts : 77
Join date : 2008-09-24
Re: Physic object
A) it appears I can only create static (unmoving, unaffected by gravity) mesh collision bodies by flagging the "actor-ghost" settings on the object logic in blender. If I mark a mesh "Actor-Dynamic" it is by default affected by gravity?
>> Yes, but no rolling physic is applied on it, to enable to rolling physic toggle the "Rigid Body" button in Blender. So basically the object will drop but not roll, the collision camera of SIO2 use Cylinder as collision object but no rolling physic is applied so you can climb a hill, be affected by gravity but you will not start rolling it down
If I want to have an unmoving collision shape, must I duplicate the object and flag it as ghost? I understand only the vertex data is used for collision, but in that case am I able to set the friction and restitution of this "floor" object in order to control the behavior when the dynamic object "bounces" off of it?
>> Unmoving in my mind means "Static" , so for that simply toggle the Actor button, the Ghost button functionality in SIO2 is a bit different then Blender, its basically for collision maps. So by having an Actor + Ghost you have a static object that is sent to the Bullet Resources (triangles in space) but SIO2 will never draw it on the screen. Its ideal on iPhone cuz basically what cost the most processing time on SIO2 is the physic... so that functionality enables you to create a low detail of you environment and use it for collision instead of the full detailed mesh (take in example the video on the homepage, I am not using the terrain as collision object (even if it look like it) I have another low res map created and applied as a Actor + Ghost. Im Bullet (might sounds strange but) the best combination is a large static mesh, so basically the terrain in the video is divided in 4 section but Im using 1 big collision map its way much faster this way.
B) it appears that when a material is applied in blender, this material has its own dynamic properties of damping, friction and restitution and that these properties OVERRIDE the object mesh actor properties. Is this correct? More appropriately, am I able to affect the values of these properties of materials being applied with BindAllMaterials.
In essence, can the sio2 engine support the control of "bounciness" when to collision objects collide? and what is the best implementation method.
>> Theres basically 2 set of physic property, one that is applied on the object itself (such as mass, damping & rotationDamping) and another one that is on the material, that will affect how this surface react/interact when it collide to another surface, that what restitution & friction do... so NO theses properties does not override the object mesh actor property.
What you mean bounciness is it horizontal spring force? If yes it is not implemented yet, cuz I didn't figure out how blender is using theses values in the Material -> Dynamic Option panel. If anybody can give me a hint on that one i'll be glad to integrate it permanently in SIO2. You can always use: setLinearVelocity on the rigid body in order to make the object jump, you can easily use an SIO2sensor to do that.
I hope this answer your question.
Cheers!
>> Yes, but no rolling physic is applied on it, to enable to rolling physic toggle the "Rigid Body" button in Blender. So basically the object will drop but not roll, the collision camera of SIO2 use Cylinder as collision object but no rolling physic is applied so you can climb a hill, be affected by gravity but you will not start rolling it down
If I want to have an unmoving collision shape, must I duplicate the object and flag it as ghost? I understand only the vertex data is used for collision, but in that case am I able to set the friction and restitution of this "floor" object in order to control the behavior when the dynamic object "bounces" off of it?
>> Unmoving in my mind means "Static" , so for that simply toggle the Actor button, the Ghost button functionality in SIO2 is a bit different then Blender, its basically for collision maps. So by having an Actor + Ghost you have a static object that is sent to the Bullet Resources (triangles in space) but SIO2 will never draw it on the screen. Its ideal on iPhone cuz basically what cost the most processing time on SIO2 is the physic... so that functionality enables you to create a low detail of you environment and use it for collision instead of the full detailed mesh (take in example the video on the homepage, I am not using the terrain as collision object (even if it look like it) I have another low res map created and applied as a Actor + Ghost. Im Bullet (might sounds strange but) the best combination is a large static mesh, so basically the terrain in the video is divided in 4 section but Im using 1 big collision map its way much faster this way.
B) it appears that when a material is applied in blender, this material has its own dynamic properties of damping, friction and restitution and that these properties OVERRIDE the object mesh actor properties. Is this correct? More appropriately, am I able to affect the values of these properties of materials being applied with BindAllMaterials.
In essence, can the sio2 engine support the control of "bounciness" when to collision objects collide? and what is the best implementation method.
>> Theres basically 2 set of physic property, one that is applied on the object itself (such as mass, damping & rotationDamping) and another one that is on the material, that will affect how this surface react/interact when it collide to another surface, that what restitution & friction do... so NO theses properties does not override the object mesh actor property.
What you mean bounciness is it horizontal spring force? If yes it is not implemented yet, cuz I didn't figure out how blender is using theses values in the Material -> Dynamic Option panel. If anybody can give me a hint on that one i'll be glad to integrate it permanently in SIO2. You can always use: setLinearVelocity on the rigid body in order to make the object jump, you can easily use an SIO2sensor to do that.
I hope this answer your question.
Cheers!
Similar topics
» Moving physic objects to specific pos
» Moving an Object before physic
» sio2ObjectDuplicate only works for Physic object ?
» How to get Transform from Physic Object?
» scaling bullet physic
» Moving an Object before physic
» sio2ObjectDuplicate only works for Physic object ?
» How to get Transform from Physic Object?
» scaling bullet physic
Permissions in this forum:
You cannot reply to topics in this forum
|
|