accelerometer (How can I make them work just the oposite?)

View previous topic View next topic Go down

accelerometer (How can I make them work just the oposite?)

Post  sgmitch on Mon Dec 15, 2008 8:51 am

Can someone show me the code so that the Accelerometer works more like a steering wheel? (I'm using Tutorial 09)

Thank you.

sgmitch

Posts : 5
Join date : 2008-12-15

View user profile

Back to top Go down

Re: accelerometer (How can I make them work just the oposite?)

Post  meteors on Mon Dec 15, 2008 9:46 am

Examine tutorial05.

Use the accelerometer values to change global rotation variables, and/or set the rotation of individual objects. Don't forget to call sio2BindMatrix on modified objects.


Best,
-joshua
avatar
meteors

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

View user profile

Back to top Go down

Re: accelerometer (How can I make them work just the oposite?)

Post  sgmitch on Mon Dec 15, 2008 10:58 am

Thanks for your response... Here's what I've done so far.
(this is code from Tutorial 09... I simply changed the 2 ">'s") This has caused my rotation to change but it's jerky. I think the problem is with the camera updating it's position... I have NOOOO idea how to fix this.

code from Template.MM

if( object )
{
// Calculate our smooth Z rotation based on
// the delta time of the application.
if( ROTZ_DIR < 0 )
{
SMOOTH_Z -= 1.0f * sio2->_SIO2window->d_time;
ROTZ += SMOOTH_Z;
}
else if( ROTZ_DIR > 0 )
{
SMOOTH_Z -= 1.0f * sio2->_SIO2window->d_time;
ROTZ -= SMOOTH_Z;
}

// If we are below 0 just reset every movements.
if( SMOOTH_Z < 0.0f )
{
SMOOTH_Z = 0.0f;
ROTZ_DIR = 0;
}

sgmitch

Posts : 5
Join date : 2008-12-15

View user profile

Back to top Go down

Re: accelerometer (How can I make them work just the oposite?)

Post  sgmitch on Wed Dec 17, 2008 8:52 pm

so has anyone alter the code so that the accelerometer in tutorial 09's? I'm not very good at altering code so I could use some help. Thanks a lot!

sgmitch

Posts : 5
Join date : 2008-12-15

View user profile

Back to top Go down

Re: accelerometer (How can I make them work just the oposite?)

Post  sgmitch on Thu Dec 18, 2008 9:42 am

forget it... I figured it out.. I didn't change the ROTZ -= tmp to ==

sgmitch

Posts : 5
Join date : 2008-12-15

View user profile

Back to top Go down

Re: accelerometer (How can I make them work just the oposite?)

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