Rotating an object that's an actor

View previous topic View next topic Go down

Rotating an object that's an actor

Post  lolita on Sat Jan 03, 2009 12:33 pm

Hi:

I dont know how to rotate an actor with the code.

I have 2 objects and both are actors:

a. A Plataform that's a cube, and it's only an actor, not a rigid body. I use it because I want it to be a support for the ball.
b. And a Ball, that is a sphere that's a dinamic actor and a Rigid Body.

So the thing is: I want to rotate the Plataform, so the Ball can interact with it.

If in Blender I rotate de Plataform in some axis (like axis x), the ball falls and move over the Plataform. So, the phisics in blender are ok. But if I do the same (i mean,rotate the Plataform) but in sio2 with this code:


Code:

SIO2object *object_plataform = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,
                                              SIO2_OBJECT,
                                              "object/plataform" );      
if( object_plataform ){
   object_plataform->rot->x = 15; // 15 is only an example, it's variable
   sio2ObjectBindMatrix( object_plataform );
}




this produce a visual rotate, buy physically the plataform isn't rotated. I think, this could be because the Plataform it's only an actor and it hasn't physics, but I need to be like that because I need it as a support for the ball.

How can I do it?.

lolita

Posts : 5
Join date : 2008-10-22

View user profile

Back to top Go down

Re: Rotating an object that's an actor

Post  meteors on Sat Jan 03, 2009 12:34 pm

Google "terrain clamping"


Best,
-joshua
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Rotating an object that's an actor

Post  meteors on Sat Jan 03, 2009 12:37 pm

By the way, if you want something like gravity, then I think you are definitely going to need to use physics.


-j
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Rotating an object that's an actor

Post  lolita on Sat Jan 03, 2009 12:58 pm

meteors wrote:By the way, if you want something like gravity, then I think you are definitely going to need to use physics.


-j

They have physic and gravity. The ball fall over the plataform for the gravity.

If i put velocity to the ball.
object_ball->_btRigidBody->setLinearVelocity( btVector3( 0.0f, 1.0f, object_ball->_btRigidBody->getLinearVelocity()[2] ) );

it move and fall then the plataform is finish.

lolita

Posts : 5
Join date : 2008-10-22

View user profile

Back to top Go down

Re: Rotating an object that's an actor

Post  sio2interactive on Sat Jan 03, 2009 4:16 pm

There's a slight difference between the way Blender is handling physic and SIO2, in SIO2 physic object have to be marked (check the video tutorial06 for more info). If an object is not tagged at least actor (which would result in static triangle mesh) it cannot interact with the physic simulation. This is done on purpose to be able to control the number of physic object in the world. In your case what I would do is set the plane as an actor, then using the bullet API I would rotate that plane with setAngularVelocity. You have to understand that as soon an object is tagged to be part of the physic sim. it have to be controlled by the Bullet API, so using like sio2ObjectBindMatrix will have no effect since Bullet is now controlling that object matrix.

Cheers,
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: Rotating an object that's an actor

Post  lolita on Sun Jan 04, 2009 3:45 pm

sio2interactive wrote:There's a slight difference between the way Blender is handling physic and SIO2, in SIO2 physic object have to be marked (check the video tutorial06 for more info). If an object is not tagged at least actor (which would result in static triangle mesh) it cannot interact with the physic simulation. This is done on purpose to be able to control the number of physic object in the world. In your case what I would do is set the plane as an actor, then using the bullet API I would rotate that plane with setAngularVelocity. You have to understand that as soon an object is tagged to be part of the physic sim. it have to be controlled by the Bullet API, so using like sio2ObjectBindMatrix will have no effect since Bullet is now controlling that object matrix.

Cheers,

Thanks a lot Very Happy. I'll check the Bullet API.

lolita

Posts : 5
Join date : 2008-10-22

View user profile

Back to top Go down

Re: Rotating an object that's an actor

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