FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Best Way to Rotate/Tilt the Whole World

3 posters

Go down

Best Way to Rotate/Tilt the Whole World Empty Best Way to Rotate/Tilt the Whole World

Post  uprise78 Tue May 26, 2009 10:05 am

I have a 3D world of platforms scattered about. When the iPhone tilts/turns I want to give the effect that the whole world is tilting with gravity effecting all items on the platforms as it happens. I've come up with a couple possible solutions:

1. When the iPhone tilts, adjust gravity to have the objects effecting properly and then just tilt or rotate the camera to give the effect of the world tilting. This has a side effect of making my skybox tilt with the world which may not look totally convincing. Perhaps the skybox can then be rotated/tilted as well to give the illusion of the platforms being tilted.

2. I haven't tried this one yet, so I wanted to see if it is feasible. Make all of my platforms have a single, invisible parent. When the iPhone tilts, just change the parent's transform and have all the children tilt with it. During all this gravity will stay the same.

Does anyone have any opinion on what is the best way to do this? Is there a big performance hit for using method 2?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  sio2interactive Tue May 26, 2009 4:41 pm

1. When the iPhone tilts, adjust gravity

>> The gravity should never change...

2.

>> Simply rotate your modelview matrix depending on the accelerometer angle, all the rest stays the same...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  uprise78 Tue May 26, 2009 5:07 pm

sio2interactive wrote:
>> Simply rotate your modelview matrix depending on the accelerometer angle, all the rest stays the same...

Rotating the modelview matrix would only change what is seen on screen, correct? This would mean that while the world would look tilted according to the modelview matrix but Bullet would still be acting on the original matrix. So, if I changed the modelview matrix to tilt 45 degrees to the left, no objects on the platforms would slide off because Bullet would still be holding them in place.

The end goal is to have the whole world be able to tilt around and objects would slide around depending on the tilt angle.

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  sio2interactive Tue May 26, 2009 5:11 pm

What are you doing exactly? Not another clone of super monkey ball or any variant of that I hope Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  Don Jaffa Tue May 26, 2009 5:14 pm

Maybe use a parent? I.e. make a ghost object that has collision disabled at the center of the world and parent everything else in the world to that? That way when it rotates the whole world will rotate around it.

Don Jaffa

Posts : 49
Join date : 2009-02-19

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  uprise78 Tue May 26, 2009 5:43 pm

sio2interactive wrote:What are you doing exactly? Not another clone of super monkey ball or any variant of that I hope ;)

Not exactly. The control system is similar though with tilting the world. There is a bit more to it though, that's for sure.

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  uprise78 Tue May 26, 2009 7:02 pm

So, it looks like parenting won't work from what I can tell unless I am missing something. When I parent the object to another it takes the parents location as well as rotation. It also doesn't affect the Bullet transform so physics don't operate as expected.

So far, changing gravity seemed to work the best. SIO2, you mentioned that gravity shouldn't be changed. Is there any reason why? What method would you suggest to tilt/rotate the world while maintaining Bullet's inner workings?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  Don Jaffa Wed May 27, 2009 4:01 am

Parenting didn't do that for me - try playing around with it more, I don't know enough to work out why it did that but I know tis possible for it to work as you want.

Don Jaffa

Posts : 49
Join date : 2009-02-19

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  uprise78 Fri May 29, 2009 10:32 am

Because all my platforms are Bullet bodies I found I can use the Bullet contraints, but it didn't seem like the right way to do things and moving the platforms had my object falling through every time.

I ended up just adjusting the gravity only on the objects that I want to take on the new gravity. I didn't realize that each object can have it's own gravity until now...it seems to work well. Are there any reasons why I wouldn't want to do things this way?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Best Way to Rotate/Tilt the Whole World Empty Re: Best Way to Rotate/Tilt the Whole World

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum