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.

Code Snippets / [DBC/DBP] Move Object using variables

Author
Message
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Sep 2007 18:18
Noobs get stuck using MOVE OBJECT because it's hard to work out how to move an object forward in 3D space.
So I have written a function to do this .



Here's a working example


In programming, nothing exists
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Sep 2007 18:19
Does this actually help? lol

In programming, nothing exists
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Sep 2007 20:55
Good to see people getting more into the maths side of things. Thing about that one is that you can only move along the XZ plain, you can't change the X angle.

Here is a function where you can set the X angle to move at too:


"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Sep 2007 22:19
This was originally a 2D object that could turn around and move forwards, I then realised that this could be very useful to noobs wanting to escape the MOVE OBJECT command.

Thanks Zo, and thanks for the function; he can go up and down hills now!

Now we wait for someone to add in Z rotation for strafing down hills

In programming, nothing exists
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 3rd Sep 2007 00:30
Z rotation doesn't really matter unless it's global, in which case, you should look at LL's rotation functions. I'm not sure it Z rotation is global in dbp.

But anyway, straffing isn't that hard when you have the maths being it. If you want to move sideways, add 90 deg onto ay#. If you wanna move down, subtract 90 deg from ax#

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers

Login to post a reply

Server time is: 2024-11-22 18:39:41
Your offset time is: 2024-11-22 18:39:41