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.

DarkBASIC Discussion / Normal to Vector

Author
Message
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 18th May 2010 05:56 Edited at: 18th May 2010 08:08
Alright, I'm using sparky's collision and and i'm trying to open a door, but only from one side. they have a command in sparky's that gets the bounce vector, but it appears that the function for it doesn't exist. I'm wondering if there is a way to get the vector from the normal. I can't figure it out, but i know if i can get the vector, i could check if the player was within 180 to 0 degrees of the door and determine which side I was on with it. I'm using the normals currently, but when the door gets to a certain angle, the normal flips from positive to negative. How could I transfer the normal value to a vector, or just determine which side im on with the normal

Any help would be appreciated.

EDIT:
Nevermind. I got it working. For some reason the normals flip after 270 or 90 degrees, so i just multiplied the normal by -1 whenever the normal flipped to make the value positive again. this way, I know which side of the door i'm on. I had the correct code for this down earlier, but had an AND instead of an OR.

owlman
14
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 18th May 2010 11:24
interesting - would love to see the code ..

if effort>reward : gosub home : endif
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th May 2010 18:00
@pictionaryjr

Even thgouh you solved your quesiton, here are the bounce vector functions for the sparky's collision .DBA file :



It seems this bounce vector is calculated from the center of the object and not the surface point of collision. The way to use the bounce vector then, would be to position another object at the point of collision, get collision for this object at that point, and use the bounce vector from there.

Enjoy your day.
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 19th May 2010 05:19
@owlman
haha alright I'll post what I got in a second although its not all that amazing. it was one of them situations where you should smack yourself in the forehead because it was soo easy.

@Latch
I have the functions. They just don't appear to exist in the dll. Like the program terminates when i tried to use them.

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th May 2010 17:54
Quote: "I have the functions. They just don't appear to exist in the dll. Like the program terminates when i tried to use them."

Really? The sparky's I have has them in it.

Did you get it from here?

sparky's

And the sparky's collision DBC functions that call the dll functions are all hardcoded with the dll number being 1. If you are using a different dll number maybe this is one of the problems. For example, let's say you are using dll number 1 for win32 api function calls and you are trying to use dll number 2 for sparky's. Because dll 1 exists, but the call in that dll to the win32 api doesn't, DBC would complain and throw an exception.

Enjoy your day.
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 25th May 2010 23:17
Nah, the dll works, just not the bounce functions. They aren't even included, but they are talked about in the whole commented out section and explained on how they work. But yea, thats where i got it from. i guess i could have just downloaded it, but oh well. I got it working now, so no point at the moment.

Login to post a reply

Server time is: 2024-03-28 11:09:18
Your offset time is: 2024-03-28 11:09:18