Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Simple Sphere rotation - Can anyone help me rotate a sphere?

Author
Message
KamiKazi Games
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location: Australia
Posted: 16th Oct 2006 10:31
Hello there, I am new and trying out DBPRO. I have searched the code base on the main website and discovered a nice 3d code there that I kinda get. But I want the character object to rotate forwards or backwards when i press the up or down arrow. This is the code I am using for this game at the moment :


Hi I just bought FPS Creator! Want to help me out?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Oct 2006 11:19 Edited at: 16th Oct 2006 11:20
You have 2 actions - rotating the sphere and moving it. Because this isn't a physical world, the ball won't move forward just by rotating it.

In your code, you have a system where the ball rotates on it's y axis, which will change it's direction. Then you have movement on the ball's local Z axis, which creates the forward/backward movement.

If you were to make it "roll", the code wouldn't work. As it rolled, it's local z axis would roll, and you wouldn't have any control over the direction.

What you could do is have a movement sphere, and a visible sphere. The sphere you already have is the movement, all you need to do is HIDE OBJECT. then you add another sphere, and position it in every loop in the same place as the original, hidden one. With this second sphere, you can ZROTATE OBJECT to give it the appearance of being rolled.



KamiKazi Games
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location: Australia
Posted: 16th Oct 2006 13:28 Edited at: 16th Oct 2006 14:30
Thamks for the feedback, it's completely understandable. I was just wondering though, seeing as im new to DBPRO, how would I go about keeping the visible one on the same location as the original? Because in my previous programming language I would just do the object names lke this:

object2.x = object1.x
object2.y = object1.y
object2.z = object1.z

But you can't do that with dbpro

Hi I just bought FPS Creator! Want to help me out?
Trowbee
21
Years of Service
User Offline
Joined: 12th Apr 2003
Location: United Kingdom
Posted: 16th Oct 2006 15:47
position object 2, object position x(1), object position y(1), object position z(1)
KamiKazi Games
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location: Australia
Posted: 27th Oct 2006 10:38 Edited at: 27th Oct 2006 10:39
OK, I got most of it to work, except the visible sphere doesn't rotate with the invisible one



Hi I just bought FPS Creator! Want to help me out?
Nenohum
18
Years of Service
User Offline
Joined: 21st Sep 2006
Location: In a galaxy far, far, away.....
Posted: 27th Oct 2006 19:35
sorry if i'm wrong but it looks like the reason the visible sphere isn't rotating is because
Should be
I'm not sure if it will work but according to but if you rotate the sphere on the z axis it might mess up the camera. What others here are saying is make another sphere position with the first sphere and then rotate the second sphere to make it look like it's happing. Therefore you don't have to rotate the invisible one.
so you can just have


i'm too lazy to test the code but this should help

some mornings, it just doesn't pay to gnaw through those leather straps
Nenohum
18
Years of Service
User Offline
Joined: 21st Sep 2006
Location: In a galaxy far, far, away.....
Posted: 27th Oct 2006 19:42
okay ignore that last post. I tested the code now. Okay so when i tested it the sphere was rotating but not always in the right direction. For example it would only rotate foward but i was going to the right. You need to either A.) have it rotate in different directions with the arrow keys. or B.) create an algorithim that can determine which direction the spehre is facing and have it rotate to that direction. Maybe you should try a. first and then see what happens. Like
or something like that.

some mornings, it just doesn't pay to gnaw through those leather straps

Login to post a reply

Server time is: 2024-11-26 07:23:42
Your offset time is: 2024-11-26 07:23:42