problem with surface
2 posters
problem with surface
Hi,
I have one bad moment ,
In Blender I create surface (for example simple plane) and make it as static (Ctrl+A)
and create object (for example, sphere) - it's dinamic object
Mass of plane = 3000 (for static objects mass not impotant , aren't it ?)
Mass of sphere = 100
Set gravity.z = -10.0f;
Put sphere on the plane (on some distance from it)
Further, when program is running sphere often falls throw surface
If sphere put down to plane, then not often, if put up - very often
If encreaze gravity.z value (for example, -2.0f) - then not often
Would you please explain how i can solve this problem
And other question:
Is impotant the mass of dinamic objects only for collision with dinamic objects or with static objects too?
P.S: Sorry for my english - it's not my native language
I have one bad moment ,
In Blender I create surface (for example simple plane) and make it as static (Ctrl+A)
and create object (for example, sphere) - it's dinamic object
Mass of plane = 3000 (for static objects mass not impotant , aren't it ?)
Mass of sphere = 100
Set gravity.z = -10.0f;
Put sphere on the plane (on some distance from it)
Further, when program is running sphere often falls throw surface
If sphere put down to plane, then not often, if put up - very often
If encreaze gravity.z value (for example, -2.0f) - then not often
Would you please explain how i can solve this problem
And other question:
Is impotant the mass of dinamic objects only for collision with dinamic objects or with static objects too?
P.S: Sorry for my english - it's not my native language
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
I create a quick tutorial for you to understand how what you want to do can be done using Blender / SIO2. I took the tutorial 6 and create a new .sio2 and plug it in instead of the tutorial06.
Heres the link:
https://www.youtube.com/watch?v=7Dk0JQrlbxA&fmt=18
Please read the comments in tutorial06 about how to sync. the physic pass with the rendering pass. What most likely happen in your case is that you are loading so you are basically rendering something like 1fps and then when everything is done you are rendering +20fps so the physic pass cannot sync with the current framerate (which is normal). You can tweak that by reseting the current fps of the SIO2window it'll take like 1 sec to recalculate the avg. fps and then SIO2 will sync the value with the physic pass.
Concerning the mass of static object it really doesn't matter, actually Im ignoring whatever values that have been set and set it 0 (Bullet required that).
As a suggestion, please keep the mass of object relatively low, Bullet suggest 1 unit = 1 kg, and I think it make sense, and SIO2 work with 1 unit is 1m so I makes the perfect combination with real world relative measurements.
Lemme know if you have any other troubles![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
Cheers,
Heres the link:
https://www.youtube.com/watch?v=7Dk0JQrlbxA&fmt=18
Please read the comments in tutorial06 about how to sync. the physic pass with the rendering pass. What most likely happen in your case is that you are loading so you are basically rendering something like 1fps and then when everything is done you are rendering +20fps so the physic pass cannot sync with the current framerate (which is normal). You can tweak that by reseting the current fps of the SIO2window it'll take like 1 sec to recalculate the avg. fps and then SIO2 will sync the value with the physic pass.
Concerning the mass of static object it really doesn't matter, actually Im ignoring whatever values that have been set and set it 0 (Bullet required that).
As a suggestion, please keep the mass of object relatively low, Bullet suggest 1 unit = 1 kg, and I think it make sense, and SIO2 work with 1 unit is 1m so I makes the perfect combination with real world relative measurements.
Lemme know if you have any other troubles
![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
Cheers,
Re: problem with surface
Thank you for the answer
I change fps and sphere not falls throw surface
Now I want rotate one of my objects
For this I do:
plane = (SIO2object *) sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/PlaneMain" );
plane->rot->x = accelerometer.x;
plane->rot->y = accelerometer.y;
sio2ObjectRender(plane, sio2->_SIO2camera, 1);
But plane is not rotate (plane is static)
What's wrong ?
Besides, scale plane is running
I change fps and sphere not falls throw surface
Now I want rotate one of my objects
For this I do:
plane = (SIO2object *) sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/PlaneMain" );
plane->rot->x = accelerometer.x;
plane->rot->y = accelerometer.y;
sio2ObjectRender(plane, sio2->_SIO2camera, 1);
But plane is not rotate (plane is static)
What's wrong ?
Besides, scale plane is running
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
After applying any type of transformation you need to update the matrix of the object with:
sio2ObjectGetMatrix
If physic is ON you need to use the Bullet function of your choice in order to rotate your plane probably with setAngularVelocity, you can get access to the rigid body handle linked to the sio2Object and apply the rotation like this:
// Make sure that the physic object is not sleeping
_SIO2object->_btRigidBody->setActivationState( ACTIVE_TAG );
// Apply the rotation on the rigid body object
_SIO2object->_btRigidBody->setAngularVelocity( btVector3( rx, ry, rz ) );
But you cannot do that on static objects...
Just out of curiosity what are you trying to do something like supermonkey ball or?
sio2ObjectGetMatrix
If physic is ON you need to use the Bullet function of your choice in order to rotate your plane probably with setAngularVelocity, you can get access to the rigid body handle linked to the sio2Object and apply the rotation like this:
// Make sure that the physic object is not sleeping
_SIO2object->_btRigidBody->setActivationState( ACTIVE_TAG );
// Apply the rotation on the rigid body object
_SIO2object->_btRigidBody->setAngularVelocity( btVector3( rx, ry, rz ) );
But you cannot do that on static objects...
Just out of curiosity what are you trying to do something like supermonkey ball or?
Re: problem with surface
But I want rotate static object. For example plane in your last tutorial (under ball)sio2interactive wrote:
But you cannot do that on static objects...
Is it possible ?
I'm not playing in this game. Now I want jast roll a ball over plane with help accelerometersio2interactive wrote:
Just out of curiosity what are you trying to do something like supermonkey ball or?
![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
Allright your issue is actually not a SIO2 issue but a Bullet issue, but lemme help ya on that one this is what you should do:
// Affect the desired rotation on your SIO2object
yourplane_SIO2object->rot->x += 0.01f; // 0.01 Degree (here change for whatever you are using, as long that its in degree.)
// Recalculate the SIO2object matrix in worldspace
sio2ObjectGetMatrix( yourplane_SIO2object );
// Assign the transformation matrix using the Bullet API
btTransform trans;
trans.setFromOpenGLMatrix( ( btScalar * )yourplane_SIO2object->mat );
btDefaultMotionState *_btDefaultMotionState = new btDefaultMotionState( trans );
// Get the current motion state and free it.
delete yourplane_SIO2object->_btRigidBody->getMotionState();
// Affect the transformation to the _btRigidBody of your SIO2object
yourplane_SIO2object->_btRigidBody->setMotionState( _btDefaultMotionState );
// Now, here since your are modifying your plane transformation (which is basically the ground)
// you need to force the Bullet rigid body to be activated, you can do this only when the
// rotation of your plane is updated (ie: when the accelerometer change or something)
unsigned int i = 0;
// Loop through all the current SIO2object of the resource manager, basically we should skip
// the plane but since its a static object it doesn't matter Bullet will ignore the activation flag
// anyway.
while( i != sio2->_SIO2resource->n_object )
{
SIO2object *_SIO2object = ( SIO2object * )sio2->_SIO2resource->_SIO2object[ i ];
// Do we have a rigid body handle?
if( _SIO2object->_btRigidBody )
{
// Simply reactivate the flag to make this object part of the
// incoming physic frame.
_SIO2object->_btRigidBody->setActivationState( ACTIVE_TAG );
}
++i;
}
// Affect the desired rotation on your SIO2object
yourplane_SIO2object->rot->x += 0.01f; // 0.01 Degree (here change for whatever you are using, as long that its in degree.)
// Recalculate the SIO2object matrix in worldspace
sio2ObjectGetMatrix( yourplane_SIO2object );
// Assign the transformation matrix using the Bullet API
btTransform trans;
trans.setFromOpenGLMatrix( ( btScalar * )yourplane_SIO2object->mat );
btDefaultMotionState *_btDefaultMotionState = new btDefaultMotionState( trans );
// Get the current motion state and free it.
delete yourplane_SIO2object->_btRigidBody->getMotionState();
// Affect the transformation to the _btRigidBody of your SIO2object
yourplane_SIO2object->_btRigidBody->setMotionState( _btDefaultMotionState );
// Now, here since your are modifying your plane transformation (which is basically the ground)
// you need to force the Bullet rigid body to be activated, you can do this only when the
// rotation of your plane is updated (ie: when the accelerometer change or something)
unsigned int i = 0;
// Loop through all the current SIO2object of the resource manager, basically we should skip
// the plane but since its a static object it doesn't matter Bullet will ignore the activation flag
// anyway.
while( i != sio2->_SIO2resource->n_object )
{
SIO2object *_SIO2object = ( SIO2object * )sio2->_SIO2resource->_SIO2object[ i ];
// Do we have a rigid body handle?
if( _SIO2object->_btRigidBody )
{
// Simply reactivate the flag to make this object part of the
// incoming physic frame.
_SIO2object->_btRigidBody->setActivationState( ACTIVE_TAG );
}
++i;
}
Re: problem with surface
Hi
I have last problem again
I create plane (now it's cube without top poligone or plane with barrier)
And create ball
All run fine untill ball gather speed. When ball move very quickly it's pass through barrier (but ball roll over surface fine)
I set FPS on 300 but it's not help
Now, I think maybe forbid to ball walk over some value and note hope that barrier stop it
But I not know how it's do correctrly. Can you help me ?
I have last problem again
I create plane (now it's cube without top poligone or plane with barrier)
And create ball
All run fine untill ball gather speed. When ball move very quickly it's pass through barrier (but ball roll over surface fine)
I set FPS on 300 but it's not help
Now, I think maybe forbid to ball walk over some value and note hope that barrier stop it
But I not know how it's do correctrly. Can you help me ?
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
Please take a look at this thread:
http://forum.sio2interactive.com/sio2-engine-f3/step-simulation-syncing-t9.htm
If it doesn't help can you like post a video on youtube or something to show me the exact symptoms, and send me a sample blend file that is causing problem, it'll help me to fully understand the problem.
Cheers!
http://forum.sio2interactive.com/sio2-engine-f3/step-simulation-syncing-t9.htm
If it doesn't help can you like post a video on youtube or something to show me the exact symptoms, and send me a sample blend file that is causing problem, it'll help me to fully understand the problem.
Cheers!
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
Hey man please find your file at the following link:
http://www.sio2interactive.com/balls_MOD.blend.zip
What I did was:
1. Run polygon reducer a few times on the balls cuz they we're really heavy 2000 triangles for a ball that is some really round ball you are going to kill the FPS on the device man
The DEMO scene on the homepage does not top more than like 5~6k of triangles when rendering. Take it easy... ![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
2. I link the Scene.sio2 with tutorial06 and comment the camera physic, build and run and all the balls sticks in the box. It's working fine over here...
Cheers,
http://www.sio2interactive.com/balls_MOD.blend.zip
What I did was:
1. Run polygon reducer a few times on the balls cuz they we're really heavy 2000 triangles for a ball that is some really round ball you are going to kill the FPS on the device man
![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
2. I link the Scene.sio2 with tutorial06 and comment the camera physic, build and run and all the balls sticks in the box. It's working fine over here...
Cheers,
Re: problem with surface
I can't load your link
I run polygon reducer and now in all scene I have 1494 faces
But problem is not disappear
When you tested tutorial6 with Scene.sio2 what gravity value you have ? 10 ? Are you speed up ball? And they not pass through sides edge of cube? My balls sometimes pass through sides![Crying or Very sad](https://2img.net/i/fa/i/smiles/icon_cry.gif)
![Sad](https://2img.net/i/fa/i/smiles/icon_sad.gif)
I run polygon reducer and now in all scene I have 1494 faces
But problem is not disappear
When you tested tutorial6 with Scene.sio2 what gravity value you have ? 10 ? Are you speed up ball? And they not pass through sides edge of cube? My balls sometimes pass through sides
![Crying or Very sad](https://2img.net/i/fa/i/smiles/icon_cry.gif)
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
humm:
http://www.sio2interactive.com/dump/Balls_MOD.blend.zip
I didn't speed up the balls in anyway, just let the gravity do its job... maybe extrude the wall to make them ticker? I really don't know man... its working fine here... I don't know what to say...
http://www.sio2interactive.com/dump/Balls_MOD.blend.zip
I didn't speed up the balls in anyway, just let the gravity do its job... maybe extrude the wall to make them ticker? I really don't know man... its working fine here... I don't know what to say...
Re: problem with surface
Hey listen up I'll try to write for you a quick project that is doing the same as you intend to do...
Keep your heads up dude, that's what programming is all about, try & error![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
Cheers,
Keep your heads up dude, that's what programming is all about, try & error
![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
Cheers,
Re: problem with surface
Fine !
by the way for simulate rotate the plane I do that :
May be sometimes ball pass through sides because gravity is high (gravity.x or gravity.y) But I put sio2->_SIO2window->fps = 100;
....
by the way for simulate rotate the plane I do that :
- Code:
vec3 gravity;
gravity.x = -accelerometer.y*10.0f;
gravity.y = accelerometer.x*10.0f;
gravity.z = -10.0f;
May be sometimes ball pass through sides because gravity is high (gravity.x or gravity.y) But I put sio2->_SIO2window->fps = 100;
....
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
I would not suggest you to manipulate it like that, the gravity is something you assign at initialization and that you are using along the way, try to use bullet API to manipulate the orientation of the ground like I show you in the sample code in a previous post.
Re: problem with surface
Why ? It's way is simple and ball behave yourself... Excepting my situation, of cause
But I try to do it your metod ....
But I try to do it your metod ....
hazeleye- Posts : 34
Join date : 2008-09-24
Re: problem with surface
Well actually I tried just for fun, and my method is not better either, Im stuck with the same problem as you, yesterday when I try I didn't implement the floor rotation. But this morning I did it and well... I have the exact same problem, when the floor rotate sometimes the balls pass right through it...
Im not sure how to fix this problem...
Im not sure how to fix this problem...
Re: problem with surface
If replace btSoftRigidDynamicsWorld with btContinuousDynamicsWorld this bug disappear ![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
![Wink](https://2img.net/i/fa/i/smiles/icon_wink.gif)
hazeleye- Posts : 34
Join date : 2008-09-24
![-](https://2img.net/i/empty.gif)
» Sub Surface
» Render unlit surface
» Ball on surface physics
» Getting objects to "stick" to a surface with friction
» Passing Through Static Object (Beating my iPod seems to help)
» Render unlit surface
» Ball on surface physics
» Getting objects to "stick" to a surface with friction
» Passing Through Static Object (Beating my iPod seems to help)
Permissions in this forum:
You cannot reply to topics in this forum
|
|