how to not rotate around object

View previous topic View next topic Go down

how to not rotate around object

Post  sakrist on Thu May 28, 2009 1:24 pm

tutorial 09

I have 2 objects: player and obj


Code:

SIO2object *object = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,
                                                  SIO2_OBJECT,
                                                  "object/player" );
         
         
         ....
         code for player
         ....
         
         SIO2object * obj = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,
                                              SIO2_OBJECT,
                                              "object/obj" );

         obj->_SIO2transform->loc->x = object->_SIO2transform->loc->x ;
         obj->_SIO2transform->loc->y = object->_SIO2transform->loc->y + object->dim->y + 1.5;
         obj->_SIO2transform->loc->z = object->_SIO2transform->loc->z;

         obj->_SIO2transform->rot->z = ROTZ;
         
         
         sio2TransformBindMatrix(obj->_SIO2transform);

         obj->_btRigidBody->getWorldTransform().setFromOpenGLMatrix( obj->_SIO2transform->mat );



need to obj does not rotate around the player.

How do it? Please help Smile

Thanks!!!!! flower
avatar
sakrist

Posts : 23
Join date : 2009-04-28
Age : 29

View user profile http://www.developers-life.com

Back to top Go down

Re: how to not rotate around object

Post  oioioi on Thu May 28, 2009 1:29 pm

You can calculate it using sin and cos. If you don't want to do the math your self you can look on sio2Rotate3d function(used in tutorial 9)

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

View user profile

Back to top Go down

Re: how to not rotate around object

Post  sakrist on Thu May 28, 2009 1:50 pm

oioioi wrote:You can calculate it using sin and cos. If you don't want to do the math your self you can look on sio2Rotate3d function(used in tutorial 9)

what you mean?

now me obj rotate around player, i need it does not rotate around player and it was behind
avatar
sakrist

Posts : 23
Join date : 2009-04-28
Age : 29

View user profile http://www.developers-life.com

Back to top Go down

Re: how to not rotate around object

Post  oioioi on Thu May 28, 2009 2:01 pm

Do you want the object to rotate around it origin? Then you select your object in blender and press "center new" or what ever it is, just watch one of the tutorials if you can find it, now it should work modifying the object->_SIO2transform->rot vector. I thought you wanted the object to rotate around your player

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

View user profile

Back to top Go down

Re: how to not rotate around object

Post  sakrist on Thu May 28, 2009 2:26 pm

oioioi wrote:Do you want the object to rotate around it origin? Then you select your object in blender and press "center new" or what ever it is, just watch one of the tutorials if you can find it, now it should work modifying the object->_SIO2transform->rot vector. I thought you wanted the object to rotate around your player

thanks

i did it, but when i move my player left or right my obj rotate around player Sad
avatar
sakrist

Posts : 23
Join date : 2009-04-28
Age : 29

View user profile http://www.developers-life.com

Back to top Go down

Re: how to not rotate around object

Post  sakrist on Fri May 29, 2009 9:56 pm

********!!!!! uuuu

obj->_SIO2transform->_SIO2parent = object->_SIO2transform;

handle parent to child

Twisted Evil
avatar
sakrist

Posts : 23
Join date : 2009-04-28
Age : 29

View user profile http://www.developers-life.com

Back to top Go down

Re: how to not rotate around object

Post  sio2interactive on Fri May 29, 2009 10:10 pm

Check tutorial14 for more info about parenting & physic... that's might be part of what you are looking for... Wink

_________________
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: how to not rotate around object

Post  sakrist on Fri May 29, 2009 10:39 pm

sio2interactive wrote:Check tutorial14 for more info about parenting & physic... that's might be part of what you are looking for... Wink


thanks....
avatar
sakrist

Posts : 23
Join date : 2009-04-28
Age : 29

View user profile http://www.developers-life.com

Back to top Go down

Re: how to not rotate around object

Post  sakrist on Sun May 31, 2009 5:01 am

sakrist wrote:
sio2interactive wrote:Check tutorial14 for more info about parenting & physic... that's might be part of what you are looking for... Wink


thanks....

lol!

Code:
SIO2object *parent = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,
                                    SIO2_OBJECT,
                                    "name parent" );
SIO2object *child = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,
                                    SIO2_OBJECT,
                                    "name child" );
 
child->_SIO2transform->_SIO2parent = parent->_SIO2transform;
avatar
sakrist

Posts : 23
Join date : 2009-04-28
Age : 29

View user profile http://www.developers-life.com

Back to top Go down

Re: how to not rotate around object

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