Best Way to Rotate/Tilt the Whole World
3 posters
Best Way to Rotate/Tilt the Whole World
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?
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
Re: Best Way to Rotate/Tilt the Whole World
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...
>> The gravity should never change...
2.
>> Simply rotate your modelview matrix depending on the accelerometer angle, all the rest stays the same...
Re: Best Way to Rotate/Tilt the Whole World
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
Re: Best Way to Rotate/Tilt the Whole World
What are you doing exactly? Not another clone of super monkey ball or any variant of that I hope
Re: Best Way to Rotate/Tilt the Whole World
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
Re: Best Way to Rotate/Tilt the Whole World
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
Re: Best Way to Rotate/Tilt the Whole World
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?
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
Re: Best Way to Rotate/Tilt the Whole World
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
Re: Best Way to Rotate/Tilt the Whole World
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?
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
Similar topics
» Cannot get Tutorial02 to rotate
» Problem in tutorial 02 using my own model
» Camera Rotate Y
» how to not rotate around object
» rotate a physics object?
» Problem in tutorial 02 using my own model
» Camera Rotate Y
» how to not rotate around object
» rotate a physics object?
Permissions in this forum:
You cannot reply to topics in this forum