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.

Dark GDK / Coordinates/Rotation error

Author
Message
Reisuke
14
Years of Service
User Offline
Joined: 28th Jul 2010
Location:
Posted: 28th Jul 2010 19:25
Hello, I'm new to this forum and I just started using DarkGDK yesterday, so don't be harsh.

I'm trying to make a simple dodging game based on Zaibatsu's tutorial.
After doing the game he guided, I tried to extend it with textures and a player model. I wanted to make the model turn and run to the direction the player wants to go.

Here is the problem though:
No matter WHAT float number I enter to the following piece of code in dbYRotate, my character ALWAYS performs the moonwalk on both directions instead of normally walking.

Here is the code:



I tried putting 90 on left and -90 on right, nothing.
I tried -90 on left and 90 on right, still the same.
I tried 270 on left and 90 on right, no change.
I tried 90 on left and 270 on right, still the same old moonwalk.

So I ask of you, PLEASE GUIDE ME WITH DARKGDK'S ROTATION SYSTEM!
What am I doing wrong, and how can I fix it?

Thanks

Now! This is it! Now is the time to choose! Die and be free of pain or live and fight your sorrow! Now is the time to shape your stories! Your fate is in your hands!
Dimension
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 4th Aug 2010 02:05
If I understand the problem I think the loop object command is over writing your rotate command. When playing an object it usually has its own set of rotations. So if you need to rotate the object you might be able to rotate the limb or something but the best way is to use the animation if thats what you're already using.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 4th Aug 2010 03:22
IDK, I usually us the dbRotate command along with dbLoopObject and the only thing that happens is that the whole animation, including the objects internal rotation get rotated to the new angle you give it, so as long as the animation is centered at 0,0 i don't have a problem.

But looking at the code, it should work, so Dimension may be correct, use dbRotateLimb(1, 0, x,y,z) to rotate the object and see if that works, that rotates the parent limb which really has no mesh data.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Aug 2010 12:49 Edited at: 4th Aug 2010 12:51
I don't understand what you mean by "moonwalk". However, the order of your commands doesn't seem to be good. dbMoveObject moves the object in its current direction. In your code, you first move the object, then rotate it afterwards. Try to exchange that: first rotate, then move. (Although this won't change that much because the direction should be already correct on the second loop.) The angles should be 90 for right and 270 (or -90) for left, supposing that your character is facing away from you.

dbLoopObject has nothing to do with rotation but you will have a problem also with that. The animation will not be correct in this way, because you execute dbLoopObject over and over again, as long as the left or right key is pressed. Every time this command is called, it restarts the animation from the beginning, so you will always see the first frame. What you should do is to keep track of when the status of the object changes and then use dbLoopObject only once. You may need to introduce a player status variable which shows if the player is walking or standing and call dbLoopObject only when the status changes. (You might also need dbSetObjectFrame, to start the new animation from the correct starting frame instead of looping through other frames in between until the start frame is reached.)

Here is an example how I would try to implement it. The object is moved always when the left/right keys are pressed but turning and starting the animation happens only when the status changes. You can test if the dbSetObjectFrame is needed or not, I'm not quite sure about that.

I have also changed the coordinate conditions in your coordinate testing commands because if you are moving left, the X coordinates should get smaller and moving right, they should get bigger, so I think the -32 and 32 limits should be the other way around.

You can check also the animation frames because playing frames 25-50 for one direction and 25-47 for the other direction is a bit strange, shouldn't these frame numbers be the same?

Does that help at all? I haven't tested this code but I think it should work. Post again if it doesn't or if I misunderstood your question.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 4th Aug 2010 16:15
Maybe I'm missing something here, but from what I can tell it sounds like you need to call two commands before your code snippet above:




This, of course, assumes that by "moonwalking" you mean that the object is performing the "walking" animation while moving in the direction that you intend - but is facing the opposite direction...

Hope this helps,

JTK

Login to post a reply

Server time is: 2024-11-19 20:17:19
Your offset time is: 2024-11-19 20:17:19