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 / I am in need of FPS Sliding Collision code for DBC

Author
Message
TDP Enterprises
20
Years of Service
User Offline
Joined: 28th Mar 2005
Location: on or in front of my computer
Posted: 29th Mar 2005 10:23
I am in need of FPS Sliding Collision code against an imported .3ds or .x level. It will also need to have collision for, Player to non-player characters, and non-player charatcers to other non-player characters. No dll's please. If I use your code, your name will be mentioned in the credits of my game. Any help on this matter will be greatly appreciated.
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 29th Mar 2005 20:10
Yes Iam too .If you want a solution? then you can visit my forum http://forum.thegamecreators.com/?m=forum_view&t=51205&b=10
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 29th Mar 2005 20:11
Download only the suff from the forum and not my model.
TDP Enterprises
20
Years of Service
User Offline
Joined: 28th Mar 2005
Location: on or in front of my computer
Posted: 31st Mar 2005 03:03
This did not help, there was no code.
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 31st Mar 2005 20:27
DOWNLOAD THE STUFF THERE IS CODE BUT YOU NEED DBC 1.13
VR2
20
Years of Service
User Offline
Joined: 14th Mar 2005
Location:
Posted: 31st Mar 2005 21:00
Quote: "No dll's please"


Why not? If you're saying that because you don't have V1.13 then I think you will have a problem with this.

I've included the code Jack was talking about (for 1.13).

However, if it doesn't work, maybe implement it yourself?

If you have DBC 1.13 then you have memblock access.

You can convert your loaded mesh to a memblock.

You can pull out the vertex data from the memblock.

Use the vertex data to create face data in an array (3 verts = 1 face). Precalculate the face normal (Normalised Cross Product of 2 sides of the triangle) and Plane distance from origin and store that with the vertex data for the face.

With your array of faces & vertices created, create a movement vector from old to new position. Loop through each face you have and check to see if the movement vector will penetrate (or get too close to) the plane the face sits on. If this is true then do a "point in poly" check to see if the vector would actually go through the triangle of the face (or if its just too close then the closest point on the plane is inside the triangle). If it would then you have a collision.

Respond to the collision by using the (stored) Face Normal to calculate the projection of the movement vector along the face (sliding). Calculate a vector to keep the player away from the plane (Collision Point vector + (Face Normal * min distance scalar)). Add the projection vector to it and that will give you your new player position.
TDP Enterprises
20
Years of Service
User Offline
Joined: 28th Mar 2005
Location: on or in front of my computer
Posted: 1st Apr 2005 02:58
When I click on the source button it says:
[quote]Error obtaining Source Code, invalid ID. Sorry but I've given up.
TDP Enterprises
20
Years of Service
User Offline
Joined: 28th Mar 2005
Location: on or in front of my computer
Posted: 1st Apr 2005 03:16
To VR2

The reason why I prefer not to use Dll's is because i do not know much about them, who created them, and what else they might do without me knowing. I am a little paranoid because, at one point I had over 130 tojans on my old computer because of an expansion to a program froze my firewall. ( I was able to save the computer(believe it or not), it did take about a month of hard work though, i haven't used it since!)

But on a happier note, From what I can understand of it, your idea looks very promising, thogh it is a little over my head. If you please could explain it some more and possibly include a sample piece, that would be fabulous. I am not that new to DarkBasic, although my knowledge of memblocks and arrays are nill.

I have some code that makes the player object(first-person)do sliding collision with every object unless I turn collision for that object off.

One more thing, does anybody know how to get the gun to stay on screen, (i've tried lock object on, and it doesn't work even though everybody says it does, i can't find my object, and if i do, it flies off in another direction than in the one i'm moving in.
Thanks in Advance!
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Apr 2005 05:23
Can somebody send us an dll example
TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 1st Apr 2005 05:59
Quote: "then you can visit my forum http://forum.thegamecreators.com/?m=forum_view&t=51205&b=10"

Your claiming TGC's forum as your own?

Note: The above I didn't say, your just crazy.

Not a ripoff of The Twilight Zone

Login to post a reply

Server time is: 2025-05-23 08:55:57
Your offset time is: 2025-05-23 08:55:57