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 / Animation/Camera Problem

Author
Message
castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 10th Feb 2009 18:35
Hey guys! I have a problem, I want to make a 3d model of a guy walk around it was already animated (I got it from fpsc) so I got the walking easily enough but then i decide to make it jump but when I try to make it jump it doesn't work.




the problem is that when I hold space it will just freeze on 1 frame in mid air and it looks wierd. Also another smaller problem is that I cant get the camera too turn with the guy any help would be apreciated


I'll post the model but I'm not sure if I'm allowed to since it's from fpsc.

"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 11th Feb 2009 07:48
It freezes on one frame because it checks if space=1 every loop and replays animation every time space=1.

Maybe change it to something like this?



castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 11th Feb 2009 16:49 Edited at: 11th Feb 2009 23:59
it gives me an error saying that the animation doesn't exist.


EDIT:

I'm Pretty sure that command only works with a video file and not an actual 3d model animation. since it's in the same folder as load animation and it's not under basic3D


Snippet from help file


"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 13th Feb 2009 00:11 Edited at: 13th Feb 2009 00:12
just use a variable as a flag



Just remember to reset jumping back to 0 when he's landed back on the ground

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 13th Feb 2009 06:51
that still doesnt work I think it's doing this since i have a walk and a jump animation.


Also another problem is that I cant get the camera too turn with the guy.

"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 13th Feb 2009 08:36
i'll have a more in depth look at your code when I get home.

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 13th Feb 2009 09:46
Try something like this:



Object Playing returns whether or not the 3d object is playing its animation. The "Animation playing" command is for avi video files.

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 14th Feb 2009 01:32
It still does not work I think it's doing this since i have a walk AND a jump animation.


Also I need to figure out how to get the camera to turn and work better. any help would be COOL!!!!!

"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Feb 2009 01:50 Edited at: 14th Feb 2009 01:51
This line might cause problems:

else up=0 and down=0

When you use an IF statement, you of course have

IF Condition

And if the condition is true it does all the stuff between the IF and the ENDIF. However, when you use ELSE this changes. If the condition is true, all the stuff between the IF and ELSE is done, while if it is false all the stuff between the ELSE and the ENDIF is done.

So if you wanted the animation to run when up or down is pressed and to stop when neither is pressed, you'd want something more like this:



Looks like you have a similar problem with the jumping part of the code.


Also, you'll want to make sure that if space is pressed, and up or down is pressed, the space takes priority, so change this to:



castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 14th Feb 2009 01:59
THANK YOU!!!!!! I got it too work! Thanks so much!

Now I still have the camera problem where I can't get it to turn, any suggestions?

"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Feb 2009 02:05
Cool .

For camera positioning, I don't like using the built-in camera-following commands. They do weird things when the player makes a U-turn. So I use this method:



This puts the camera at the object's position. It rotates the camera to point the same way as the object and a little bit down. Then it moves the camera backwards. This all happens between syncs, so it seems to the player that the camera is just hovering behind the player.

castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 14th Feb 2009 02:15 Edited at: 14th Feb 2009 02:16
OK cool! there's only one slight problem. the camera will turn the oposite way when I turn. Should I just make this lline



yrotate camera object angle y(1)


IN to this?


yrotate camera -object angle y(1)


"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Feb 2009 02:21
Hmm, that's weird. I guess you can try the negative sign. If that doesn't work, could you post the new revised code?

castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 14th Feb 2009 02:23 Edited at: 14th Feb 2009 02:24
ok, it works for the most part but when I keep on turning in any direction for about a full turn the camera starts going the opposite way for another full turn the locks on again. It's really weird


Here is my current code




"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 14th Feb 2009 02:28
wrapvalue() is a command you should look up.

And consider using a variable to store the angle

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 14th Feb 2009 02:32
Quote: "wrapvalue() is a command you should look up."



I looked it up but I dont really understand it/how i would use it.

"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Feb 2009 02:38 Edited at: 14th Feb 2009 02:45
I actually don't use wrapvalue often. I've found that if you put a value into a command as an angle greater than 360 it automatically wrapvalues for you.

(All it does is if you put in a value greater than 360, it wraps it around so it is back in the range of 0-360. For example, if you put in 410 it would return 50. 1000 would return 280)

It probably could cause problems in some cases, but in this case it seems to be the way you're turning the object. You're using the Freeflight commands TURN OBJECT LEFT and TURN OBJECT RIGHT, which are well known for not working correctly with angle-based stuff. When I changed your rotation code to:



and the 3rd line in my camera follow code to:



It seemed to work correctly.

Whew. This is why I hate angles .

castek
17
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 14th Feb 2009 02:46
Thank you so much again!! I got it too work! Thank you!!!!!!!!!!




If anyone cares here is my code:





"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb

Login to post a reply

Server time is: 2024-11-25 10:23:51
Your offset time is: 2024-11-25 10:23:51