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 / Hills and steepness

Author
Message
Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 25th Feb 2008 18:25
Hello, I want to find out how steep a hill is. What i thought of to use for a method is to simply get cordinates for the point 3 or 4 places in front of my character. But i need to get the angle of my character, which i am able to do. But how do i then get the point in front of my character? Based on the angle it's pointed?

Probably easily solved, but after i have managed this I can fix the rest my self, as falling etc.

Thanks
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Feb 2008 19:31
I have given some pretty good posts about this - search for my name and atanfull to see what you get - also note I learned from the DarkBasicPro forum - so check there too - not just for me - but for atanfull in the subject bodies - Maybe some googling would be best. Check Code Base for "Angles" "Finding angles" to... whatever - but I KNOW there is a ton of info about this.

Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 25th Feb 2008 19:52
Sorry if I wasn't very clear.
I want to find the cordinates of something 2 points in front of me. I can't just add to the cordinates I am at as that would give me something that could be to the right or the left, or even backwards. As you use dbMoveObject, the object moves according to where it's pointing. But now i want to get the cordinates to where it WILL move the next time. Get it? The atanfull will help me alot, but not at the moment. But thanks for that one aswell
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Feb 2008 20:20 Edited at: 25th Feb 2008 20:22
Got your email notification. I Personally cheat. Yup.

Every Program I do - I have one object that is "Excluded" all the time. (So its never rendered) It's designed to look like a 3d AXIS "star" in case I need to see it during debugging. I DUB this object - my ANGLEFINDER.

Position your Angle finder to your Object's Position. Orient Angle finder to Your Object's (either orient object to object) or Set the Rotational axis to match.

Now MOVE OBJECT (your desired amount forward). Now you have the look ahead values. Furthermore - you can use the Angle finder's new postion to do Distance calculations.

NOTE: Bug in DBPro/DarkGDK - SOMETIMES the Angles don't report correct IMMEDIATELY afer you rotate and object (Same might be true for position but dont know). for this - when I see it - I do something like:

TURN OBJECT LEFT
(Now I read the values and let's assume they are wrong. Well Seeing how I turned left, my little BUGFIXER workaround is)

PITCH OBJECT UP 90
PITCH OBJECT DOWN 90

NOW I read those angles and they are spot on. Stupid? Yeah - but does it work? Yeah.

Now, FORGET what you read. If I was pitching and object up/down and getting questionable values when I read the new angles, I would turn left 90, turn right 90. The Idea is to turn on another axis besides the one you wanted (but got funky angles when you queried the object's new angles)

Does that help?

[edit]
You could just move your model forward 10, read the position, and then move it back 10... without having an anglefinder thingy of your own - but you'll need one eventually.
[/edit]

Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 25th Feb 2008 21:58
Thanks, that helped me

Although I'm quite sure you didn't mean it exactly as i made it, here how i did:



jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Feb 2008 00:47
Cool.

Now (I know that might just be a piece of a test but in case its not) Get into the habit of using Variable Names instead of Object Numbers.

int objSphereID = 88;
dbMakeObject(objSphereID);

Good Luck!

Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 27th Feb 2008 12:41
How come? Why is that better?

Anyhow, thanks
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Feb 2008 13:09
It makes your code more readable than a bunch of numbers - and it is not a big deal now - but when your project gets bigger - it will help you debug things quicker not to mention help other people read your code.

Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 27th Feb 2008 13:17
Oh, okay. Ill change that from now on. Mostly thought of there was any other reason than convenience
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Feb 2008 13:35
None. some people use defines for this:

#define objTruckID 1

but I am less rigid:

int TruckID = 1;

Works for me also.... Of course once you have a bunch of objects, an array might serve best - and individual ID's become less important.

I did a neat technique in that IronInfantry DPRo source code release - thAt made one array of my objects (and everything else) - a user defined type - a Basic version of a C++ struct or class... and the Idea was I had a dev mode that would display text - like Object Position, Angle, height above ground, and the name of it. And depending on the type - some things it wouldn't display - but I could navigate thorugh this array and see everything - and I could even make this object appear I call the TOY - that served as a 3d Cursor - so when I iterated to a 3d sound - I could SEE it it's position by looking for this cursor like "toy".

Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 27th Feb 2008 13:46
Great idea, I'll start using that. Never got to that point but i started thinking about how i should make the gravity apply to ALL objects etc. With this, I can. Thanks once again

Login to post a reply

Server time is: 2024-09-29 13:34:00
Your offset time is: 2024-09-29 13:34:00