Transformations not happening

View previous topic View next topic Go down

Transformations not happening

Post  bugman_2000 on Fri Jun 12, 2009 8:38 pm

Hi,

I'm trying to get a character walking around basically, using the action animations from tut 15 and the simple transformations (rotation, translation) from tut 2. I've got the action animations working but for some reason I can't figure out how to get the object to respond to updated rotation and location values. The values are changing, but the character isn't moving.

Any ideas what I'm missing? Here's the templateScreenTouchMove function I'm using.

T


Code:

void templateScreenTouchMove( void *_ptr )
{
   SIO2object *frankie=  sio2ResourceGetObject( sio2->_SIO2resource,
                                    "object/frankie" );
   vec2 d0, d1;
   d0.x = sio2->_SIO2window->touch[0].x - start.x;
   d0.y = start.y - sio2->_SIO2window->touch[0].y;
   
   d1.x = sio2->_SIO2window->touch[1].x - start.x;
   d1.y = start.y - sio2->_SIO2window->touch[1].y;
   printf("d0.x = %f\n", d0.x);
   
   if( d0.x > 5.0f || d0.x < -5.0f )
   {
      sio2ObjectSetNextAction( frankie, "walk", 0.25f, 10.0f );
      
      frankie->_SIO2transform->rot->z += ( d0.x * 0.025f );
      frankie->_SIO2transform->loc->x += ( d0.x * 0.005);
      //printf("rotz %f\n", frankie->_SIO2transform->rot->z);
      sio2TransformBindMatrix( frankie->_SIO2transform );

   }   
}

bugman_2000

Posts : 14
Join date : 2009-04-30

View user profile

Back to top Go down

Re: Transformations not happening

Post  sio2interactive on Fri Jun 12, 2009 8:49 pm

You should use Bullet to control the player within the world... setLinearVelocity is probably what you are looking for...

_________________
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: Transformations not happening

Post  bugman_2000 on Fri Jun 12, 2009 9:46 pm

Thanks, I've got him moving around now.

bugman_2000

Posts : 14
Join date : 2009-04-30

View user profile

Back to top Go down

Re: Transformations not happening

Post  _-MADMAN-_ on Sat Jun 13, 2009 12:38 pm

Anyway, If You want to have full control and dynamic feeling - use forces. Especially, If Your player is/can use vehicle.

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Moving, but not correctly

Post  bugman_2000 on Sun Jun 28, 2009 8:37 am

Hi,

Thanks for the replies previously. I got the character moving using forces. However, the linear velocity seems to be pushing him according to global coordinates... at least, the character rotating on its z axis has no effect on the linear velocity coordinates. For turning, I'm using setAngularVelocity, which makes him turn nicely in place, but it has no influence on the direction he moves.

In the tutorials such as tut 6 the camera moves using linear velocity and the rot->z value, but I haven't managed to figure out how to mimic that with this character. I've tried using rot and linear velocity but I can't get him to rotate this way.

Also, a little more explanation would be very welcome about *why* forces are better than location transforms, and more specifically why the transforms have no effect.

Thanks!

T

bugman_2000

Posts : 14
Join date : 2009-04-30

View user profile

Back to top Go down

Hi

Post  narender.mudgal on Sat Aug 08, 2009 1:31 pm

I am very new to sio2. I have been facing some problems and as I am new I am not able to understand
where to put my query. I want to ask you very simple thing. From some where i got some code
and i tried to modify the project so that i can learn and understand the changes. I have one cube and
one object on existing object . like in tutorial 3.
my_object = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/pin" );
my problem is i dont know how to identify that object on touch. I tried with x,y position but if i move the
cube on x or y object than again pin object's x,y will change. i am working in objective c and there
on clicking i can identify the image like
[touch view] == img; thats it . please help me to know more.
I am very interested to learn 3D concepts.
one more thing I have on sio2 file, if i add that to tutorial 3 and change the name in existing project
it is not showing my object. is there any procedure for doing that.

Thanks a lot for reading this post.
Naren

narender.mudgal

Posts : 7
Join date : 2009-08-08

View user profile

Back to top Go down

Forces to control vehicle object

Post  vikthered on Sat Aug 08, 2009 3:00 pm

@Madman,

Can you please elaborate on using Forces to control a vehicle? I'm have a vehicle in third person cam mode and i'm trying to move it over a terrain with slopes/hills. I'm unable to adjust my vehicle's orientation whenever it goes upslope/downslope.



Thank you

vikthered

Posts : 25
Join date : 2009-06-25

View user profile

Back to top Go down

Re: Transformations not happening

Post  sio2interactive on Sat Aug 08, 2009 3:54 pm

Check the vehicle demo in the Bullet SDK...

_________________
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: Transformations not happening

Post  vikthered on Sat Aug 08, 2009 4:16 pm

Has anyone implemented the vehicle demo? Is it slow on a device?

vikthered

Posts : 25
Join date : 2009-06-25

View user profile

Back to top Go down

Re: Transformations not happening

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