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 / [DBP] BSP style sliding collision with only a .X model

Author
Message
Ronaldaveo
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: England
Posted: 26th Oct 2003 23:20 Edited at: 26th Oct 2003 23:28
Sorry about the smooth stairs its an invisible wedge in cshop. My geforce 2 gets about 40 - 60 fps with the lightmap on.
gbuilder
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: New Zealand
Posted: 27th Oct 2003 01:45
Ahh, the invisible ramp trick. And yea that's about the same fps as mine when I'm in 16 bit mode, 32 bit slows it down. How difficult is it to export a .x light map from cshop? There doesn't seem to be a lot of info on it in the cshop forum.

gbuilder.

AMD900mhz, 256mb Ram, 64mb GForce2 MX400 Graphics card, Windows 98se.
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 27th Oct 2003 01:45
Any chance you can make an exe of it? I cant compile it without DBPro.

ZEDWARE website coming soon... //END TRANSMISSION//
Ronaldaveo
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: England
Posted: 27th Oct 2003 02:13 Edited at: 27th Oct 2003 02:15
Exexutable Versions
http://stateproperty.users.btopenworld.com/lmxcol.zip

To export a light map after creating a light I used dreamflower's .x exporter and it makes all of the files for you, then I just used the code in the source to load it.

http://www.dreamflowers.org/

AMD Athlon XP 3000+ 200FSB ; 256MB PC3200 ; Geforce 2 MX400
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 27th Oct 2003 07:02
The few things I don't like about the the re-work code is that gravity is now at a constant rate. This isn't very realistic. It will make ramps smoother, but I like the realism. Second, now if you accidentally walk off the map you fall forever. And finally I hate "WASD" controls. I only use mouse for movement in any FPS.

I do like the "invisible ramp" for stairs. I was too lazy to do that. Besides, I don't think it makes too big a difference in a finished game. Nice work though.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 29th Oct 2003 17:34 Edited at: 29th Oct 2003 17:34
OK tried this new one and I think :

o Get rid of the magnetic gravity - too unrealistic and it annoyed me, being sucked to the ground when I fell off the bridge.

o Keep the ramps for stairs gimmick - at first I thought this looked a bit iffy, but realised many commercial games (Max Payne being one) used this method. Only drawback is on stairs where each step is longer eg


o Major bug found when you walk into the corner opposite the gap where you can fall off the map. Screen starts to stripe and flicker-very bad!!!

ZEDWARE website coming soon... //END TRANSMISSION//
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 30th Oct 2003 00:51
"I only use mouse for movement in any FPS."
what about strafing?
what FPS use only mouse...?
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 31st Oct 2003 02:18
question:
will this collision code only work for one .x model?

only object 1 recieves collision. The rest of the models have no collision. i originally thought the collision detection deteced for any model, not just your world
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 1st Nov 2003 07:03
The way the code is written now is that only one object is getting checked for collision. If you wanted to have a huge level, you'd have to split it up and write a function to find out which object number to pass to the collision code. You can use ANY model. It doesn't have to be the one I made or made in any specific program. I tried one from Milkshape and CShop. Both worked fine.

To answer the "strafing" comment. I use a really screwed up key combo. I have "s" for walk backwards and "z" is strafe left "x" is strafe right. I use the mouse to look, walk forward and shoot/act.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 1st Nov 2003 21:57
Will using more than one model ata time for collision hurt the speed a lot?

I was going to use the collision code for the buildings in my RPG (they arent simple).. i will have around maybe 100 buildings in the game... i cant put them all into the level model because new ones are built and some get destroye

is there a way for the code to detect all .x faces no matter the model?
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 1st Nov 2003 22:12
The more times you call my collision code per do/loop the slower it is. My roommate came up with a good solution. Do a distance check for each object and only check collisions one the one(s) you are close to. This will keep the FPS up and still give you collisions with all objects.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
gbuilder
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: New Zealand
Posted: 2nd Nov 2003 08:45 Edited at: 2nd Nov 2003 21:36
Sounds like a useful way to do it, any chance of an example piece of code..?

gbuilder.

AMD900mhz, 256mb Ram, 64mb GForce2 MX400 Graphics card, Windows 98se.
3dZmaster
21
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 2nd Nov 2003 17:34
Heres example on counting the distance of two points in space. Its only X and Z axis tho, but you can improve it.



Then u'll need to make many routines for the different objects. Function would be much more wiser to do. I could convert it into function If I have time. Or someone else can.

Hope this helps, and please aks for more help!

dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 3rd Nov 2003 14:28
Has Anyone been able to get this code to work not beinging in first
person? I perfer 3rd person view any day over first. I tried nuclear-
glory's dll and got the same result as this code. Has anyone ever
made a good game with dbpro in 3rd person?
Signed,
Frustrated
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 4th Nov 2003 16:47 Edited at: 4th Nov 2003 16:50
My game has a zones thing, in which I would only check for collision if the building object is in the same zone as my character. My question is, how do i decide which object i want kensupen's collision code to check?

thanks
Chris

edit: by zones i dont mean zones like EQ..in my game i classify it differently. when you load a map/level, the whole map area is called a region, and it is subdivided into square zones. if a model is in your zone or next to your zone, the ocmputer calculates his stuff.

another edit: i can check collision for more htan one object at a time right?
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 5th Nov 2003 02:24
I have made a demo of sort like you state here. I have a massive level (.X) and I divided it into 36 smaller squares. What you'd have to do is figure out which model number you are over/on. (The model number of the smaller piece of the region) Then use the collision code against that model number.

You can call this code as a function as many times as you like, but it slows down massively when the intersect object is used more than 25 times/loop. My check does 9, so you can prolly call it 3 times without too much FPS loss.

I think you can append one model to another to make everything you load (trees, barrels,etc.) to become part of the level at load time. I'm not possitive or even sure how to do it. I usually just make everything into the level that I want collision against.

If I ever find the time, I'm going to make a QuakeII or Counter Strike type single player deathmatch demo. I'm going to use my collision code, make the level in CShop and it will have operations doors and lifts. You will have to interact with levers/buttons also. I may do a rescue the VIP type. All depends when I find the time and/or get bored enought to start it.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 5th Nov 2003 22:59
kensupen where is this demo?
EddieRay
21
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 6th Nov 2003 05:41
Look Mom... no bubble sort!

You really don't need it since you just need to know the one direction that has the closest intersection...

Desktop: AMD900/256MB/Radeon 8500 64MB/Win98SE/DX9.0b/Catalyst 3.7
Laptop: P3-850/384MB/GeForce2 Go 16MB/WinXP Pro/DX9.0b/Detonator 45.23
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 7th Nov 2003 05:50
I never released the demo of my massive landscape because I couldn't get it to look ok. The textures and normals were all hosed so I stopped working on it. The functionality was all there, but I never went any further. I explained everything I did in that program above.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
EddieRay
21
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 7th Nov 2003 09:04
By the way... great work Kensupen!

Do you think without the overhead of the bubble-sort, that you could do many more intersection calculations than before?

I tested your code on one of my own .X CShop levels and it worked very nicely. This is SO very cool!

Desktop: AMD900/256MB/Radeon 8500 64MB/Win98SE/DX9.0b/Catalyst 3.7
Laptop: P3-850/384MB/GeForce2 Go 16MB/WinXP Pro/DX9.0b/Detonator 45.23
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 7th Nov 2003 23:06
As far as I have found, you can only call the intersect object function about 25 times per loop without seeing a massive FPS hit. For most games using 8-way X-Z detection and 1 for height works out great. It's not perfect, but it allows you to play.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 12th Nov 2003 23:30
Since this is a collision topic, you might also try a collision system I've been working on for some time. I formerly worked with Sonic on it, and the first release got dubbed as "Sonic's DLL".

About a month ago we release v2.0 which is designed specifically for DBPro and includes a powerful set of automatic functions and is designed to be upgraded with minimum hassle. An new upgrade is coming out in 1-2 weeks including a powerful new set of functions and some minor fixes over the current 2.0 release.

The link to download is: http://www.nuclearglory.com

Lead Programmer/Director
Powerful Collision DLL for DBPro: http://www.nuclearglory.com
gbuilder
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: New Zealand
Posted: 22nd Nov 2003 03:58 Edited at: 22nd Nov 2003 03:59
Great, will give it a try. One or two 'complete' examples of FPS and 3rdPerson would be helpful to show how it works..

gbuilder.

AMD900mhz, 256mb Ram, 64mb GForce2 MX400 Graphics card, Windows 98se.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 22nd Nov 2003 05:12
A 3rd person example is planned for the upcoming release. It will demo a lot of the power/features of the collision system.

Some of these features include:

- Ellipsoid to mesh support
- Moving ellipsoid to moving mesh support
- Moving ellipsoid to moving ellipsoid support
- Enhanced mesh collision routines
to glide over edges and around corners
- Automatic handling
of all of your collision objects
- Definition system
easily setup and define collision objects
- Ray-Intersect
intersect ellips and/or meshes that will return the position, angle, normal, and distance of collision
- Collision responses
Stick, Slide, Sliding but not down slopes, Sliding without fighting gravity while going uphill, and no response (great for hotzones)
- Dynamic collision responses:
no-response, normal response to moving mesh, locking response to moving mesh (so if the platform won't move out from under you if you're standing on it)
- Feedback system
cycle through the collisions an object went through and get their exact contact points, normals, etc...
- Internal optimizations
to quickly skip meshes/objects that are out of range
- Activate/Deactivate system
you can quickly disable objects for collision entirely (very useful for disabling objects out of range in large worlds) and re-activate them when you need
- 5 concave modes
used to make collision fast/stable in tight corners. Different modes available so you can select the mode that produces the best results for your style game

It will have an example set and 3rd person demo.

Some of these are reserved for the shareware copy of the system. The shareware copy will cost a one-time flat fee of $15, it can be used unlimitedly and on team projects at no extra charge, and will come with DBPro, DB Classic, and blitz compatible packages. So if you decide to use a different engine you won't have to pay again.

Quite a bit was covered quickly. Feel free to post if you have any questions

Lead Programmer/Director
Powerful Collision DLL for DBPro: http://www.nuclearglory.com
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 23rd Nov 2003 19:29
That DLL sounds like a dream come true. Im gonna get it when I can. Sounds like it solves all DBPro's collision problems in one tasty package, and its cheap, works out at about a tenner in the UK. Which is good for a one off payment. And especially good as youre then entitled to the updates aswell. Pure class.

ZEDWARE website coming soon... //END TRANSMISSION//
dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 26th Nov 2003 17:21
This is where I am at as far as placing colz charactor on a cshop
map. Still needs work but I don't know if I'm capable of doing.
Use Kensupens map or your own x file but it won't work with matrix
floor. I can get it to work good but like I said with a few things
needing work. don't change charht# cause it don't matter the way
it's set-up. just position object inside your x-files room
(with x-position and z-position)and boom! your sucked to the floor or should be anyway. I put the "checks and dims) in the subroutine
cause I get more fps. Also have camera collision, the smoothing in set camera to follow has to be 10 or higher so it will reposition
itself after hitting a wall. any lower and camera collision gets a little buggy. Can someone else work out the problems? Be my quest!
Dugzilla
dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 26th Nov 2003 17:32
The source code I listed last is incorrect, Try this one below.
Dugzilla
dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 26th Nov 2003 17:37
For some reason when I hightlight all of my code it cuts out
a section in the middle. So the code I posted will not work! I'm going to try this in two parts. there is the first part below....
dugzilla
dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 26th Nov 2003 17:39
Here is the second and final part.
Dugzilla
dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 26th Nov 2003 17:48
Still cut out code. Lets try this,
Dugzilla
sync
center text screen width()/2,screen height()/2,"LOADING"
sync
sync rate 100
sync on
color backdrop 0
set ambient light 100
set camera range 0,1,5000
````````````````````````````````````````````````````````````````````
load object "land.x",1
position object 1,0,0,0
yrotate object 1,180
````````````````````````````````````````````````````````````````````
load object "colonel z\colz.x",2
rotate object 2,-90,0,0
position object 2,0,0,-2000
set object speed 2,20000
scale object 2,75,75,75
fix object pivot 2
````````````````````````````````````````````````````````````````````
do
set cursor 1,1
print "Fps=",screen fps()
gosub player_control
gosub camera_and_collision
gosub collision_and_ramp
sync
loop
````````````````````````````````````````````````````````````````````
player_control:
if spacekey()=1 then position object 2,0,0,0
if upkey()=1 then move object 2,+7 : loop object 2,26700,32100
if upkey()=0 then loop object 2,1,9000
if downkey()=1 then move object 2,-7
if rightkey()=1
yrotate object 2,wrapvalue(object angle y(2)+5)
loop object 2,26700,32100
endif
if leftkey()=1
yrotate object 2,wrapvalue(object angle y(2)-5)
loop object 2,26700,32100
endif
return
````````````````````````````````````````````````````````````````````
collision_and_ramp:
radius#=30.0
checks=8
if checks<8 then checks=8
if checks>8 then checks=8
angwidth=360/checks
dim ang#(checks-1,2)
dim sort#(checks-1,2)
for x=0 to checks-1
chx#=newxvalue(x#,x*angwidth,100)
chz#=newzvalue(z#,x*angwidth,100)
ang#(x,1)=intersect object(1,x#,y#+50,z#,chx#,y#,chz#)
if ang#(x,1)=0 then ang#(x,1)=999999
ang#(x,2)=x*angwidth
sort#(x,1)=ang#(x,1)
sort#(x,2)=ang#(x,2)
next x
for x=0 to checks-2
for y=x+1 to checks-1
if ang#(x,1)>ang#(y,1)
temp#=ang#(x,1)
temp2#=ang#(x,2)
ang#(x,1)=ang#(y,1)
ang#(x,2)=ang#(y,2)
ang#(y,1)=temp#
ang#(y,2)=temp2#
endif
next x
next y
print "Player Distance to Wall=",ang#(0,1)
prev=wrapvalue(ang#(0,2)-90)/angwidth
nxt=wrapvalue(ang#(0,2)+90)/angwidth
newd#=radius#-ang#(0,1)
newa#=wrapvalue(ang#(0,2)-180)
newd1#=radius#-sort#(prev,1)
newa1#=wrapvalue(sort#(prev,2)-180)
newd2#=radius#-sort#(nxt,1)
newa2#=wrapvalue(sort#(nxt,2)-180)
if ang#(0,1)<radius# and ang#(0,1)>0.0
repx#=newxvalue(x#,newa#,newd#)
repz#=newzvalue(z#,newa#,newd#)
position object 2,repx#,y#,repz#
endif
x#=object position x(2)
z#=object position z(2)
if sort#(prev,1)<radius# and sort#(prev,1)>0.0
repx1#=newxvalue(x#,newa1#,newd1#)
repz1#=newzvalue(z#,newa1#,newd1#)
position object 2,repx1#,y#,repz1#
endif
x#=object position x(2)
z#=object position z(2)
if sort#(nxt,1)<radius# and sort#(nxt,1)>0.0
repx2#=newxvalue(x#,newa2#,newd2#)
repz2#=newzvalue(z#,newa2#,newd2#)
position object 2,repx2#,y#,repz2#
endif
charht#=130
x#=object position x(2)
y#=object position y(2)
z#=object position z(2)
sub#=intersect object(1,x#,y#+125,z#,x#,y#-(charht#*2),z#)
ht#=(y#+charht#)-sub#
if sub#=0 then ht#=charht#
grav#=grav# -2
if y#+grav#<ht#
grav#=0.0
position object 2,x#,ht#,z#
else
ht#=y#+grav#
position object 2,x#,ht#,z#
endif
return
````````````````````````````````````````````````````````````````
camera_and_collision:
x#=object position x(2)
y#=object position y(2)
z#=object position z(2)
a#=object angle y(2)
d#=150
h#=130
s#=20
set camera to follow 0,x#,y#,z#,a#,d#,h#,s#,0
radius#=10.0
checks=4
if checks<4 then checks=4
if checks>4 then checks=4
angwidth=360/checks
dim ang#(checks-1,2)
dim sort#(checks-1,2)
cx#=camera position x()
cy#=camera position y()
cz#=camera position z()
for x=0 to checks-1
chx#=newxvalue(cx#,x*angwidth,100)
chz#=newzvalue(cz#,x*angwidth,100)
ang#(x,1)=intersect object(1,cx#,cy#+50,cz#,chx#,cy#,chz#)
if ang#(x,1)=0 then ang#(x,1)=999999
ang#(x,2)=x*angwidth
sort#(x,1)=ang#(x,1)
sort#(x,2)=ang#(x,2)
next x
for x=0 to checks-2
for y=x+1 to checks-1
if ang#(x,1)>ang#(y,1)
temp#=ang#(x,1)
temp2#=ang#(x,2)
ang#(x,1)=ang#(y,1)
ang#(x,2)=ang#(y,2)
ang#(y,1)=temp#
ang#(y,2)=temp2#
endif
next x
next y
print "Camera Distance to Wall=",ang#(0,1)
prev=wrapvalue(ang#(0,2)-90)/angwidth
nxt=wrapvalue(ang#(0,2)+90)/angwidth
newd#=radius#-ang#(0,1)
newa#=wrapvalue(ang#(0,2)-180)
newd1#=radius#-sort#(prev,1)
newa1#=wrapvalue(sort#(prev,2)-180)
newd2#=radius#-sort#(nxt,1)
newa2#=wrapvalue(sort#(nxt,2)-180)
if ang#(0,1)<radius# and ang#(0,1)>0.0
repx#=newxvalue(cx#,newa#,newd#)
repz#=newzvalue(cz#,newa#,newd#)
position camera repx#,cy#,repz#
endif
cx#=camera position x()
cz#=camera position z()
if sort#(prev,1)<radius# and sort#(prev,1)>0.0
repx1#=newxvalue(cx#,newa1#,newd1#)
repz1#=newzvalue(cz#,newa1#,newd1#)
position camera repx1#,cy#,repz1#
endif
cx#=camera position x()
cz#=camera position z()
if sort#(nxt,1)<radius# and sort#(nxt,1)>0.0
repx2#=newxvalue(cx#,newa2#,newd2#)
repz2#=newzvalue(cz#,newa2#,newd2#)
position camera repx2#,cy#,repz2#
endif
return
````````````````````````````````````````````````````````````````
gbuilder
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: New Zealand
Posted: 26th Nov 2003 19:53 Edited at: 26th Nov 2003 20:04
Not Bad,
I used kensupens original mslevel.x level and the Colz.x character. Camera collision is working and the Character collision is working.
There are a couple of anomalies.. The Character can jump backwards onto the ramp and when it gets jammed in a corner, it vibrates like hell. I get 45 to 48 fps.
Keep at it...

gbuilder.

AMD900mhz, 256mb Ram, 64mb GForce2 MX400 Graphics card, Windows 98se.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 26th Nov 2003 22:38 Edited at: 26th Nov 2003 22:49
Okay, we've got a demo up.

It's posted in the "Work in Progress" section.

Here's the link:
http://darkbasicpro.thegamecreators.com/?m=forum_view&t=20816&b=8

It has screens as well as 3rd person camera control in the demo.

Edit: Our system does have 6 different concave modes designed specifically to handle corners without jitter. And you can select the mode that best works for you. For an FPS game a mode of 3 works well, and for a free-flight space game of sorts you might want a higher mode.

Go ahead and jam the soldier into corners in the demo above

Lead Programmer/Director
Powerful Collision DLL for DBPro: http://www.nuclearglory.com
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 27th Nov 2003 10:07
Since I don't have a lot of time to work on coding anymore, I'm going to work with the Nuclerglory team and let them try to advance my code and hopefully give them ideas to make their DLL better. I figure trying to create competition is a waste of energy, I'd rather work with them to make better code. (Besides, they are better coders than I) Hope you will use our code/DLL in your games.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 27th Nov 2003 10:46
What a fine idea. Good luck

ZEDWARE website coming soon... //END TRANSMISSION//
Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 27th Nov 2003 20:27 Edited at: 27th Nov 2003 20:30
EDIT: sorry posted this in the wrong section

Once you start down the Dark Path, forever will it dominate your destiny...
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 28th Nov 2003 16:09
ummm... can some1 help me with kensupen's code, when I move my camera with greater speed I go trough walls, why is that? and is there a solution for it?

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
gbuilder
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: New Zealand
Posted: 28th Nov 2003 20:15
I suggest you post your code or a link to download your project... it could be a number of things..

gbuilder.

AMD900mhz, 256mb Ram, 64mb GForce2 MX400 Graphics card, Windows 98se.
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 29th Nov 2003 04:00
I know exactly what is going on. (Or at least have a good theory) The collision code is checking to see if you are <20 units from a wall, if you are then push you away. If the camera moves at > 20 units/loop then you can pass right through the walls.

Example:
Say your camera is 20.87 units away from the wall. If you move the camera 21 units, the camera will then be 0.13 units past the wall and it will push you the direction you are facing to 20 units from the opposite side of the wall. Hence you go through it.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 30th Nov 2003 18:06
I thought so to, but is there noting to do about it? like checking where the normal of the polygon is pointing to and the position the camera on that side

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 1st Dec 2003 07:29
It would take a lot of coding and tricks to make it a lot better than what I have now. I'm trying to find time to work on it again and make some massive updates to it for better accuracy. Right now, I don't have the time.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 1st Dec 2003 17:49
:-o, but when you do upgrade it for better accuracy make sure the speed doesn't drop to bad

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 2nd Dec 2003 02:46
That's the goal. Maybe even try for a speed-up.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 2nd Dec 2003 17:10
I would like to know where you've learned to make that calculations and stuff needed for sliding collision, cuz I would like to learn it to so I can help you out or maybe even write my own code

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 3rd Dec 2003 02:18
All my collision code is based on standard Geometry. (I learned it in 10th grade) The basics of my code is use a +pattern of intersect objects that always face N,S,E & W, if any of those is levv than 20, move the camera the opposite way to 20. The sliding part happens automatically.

I hope to find time to update this again, cause I've had some ideas for how to improve it, but I won't be sure til I try them.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 3rd Dec 2003 22:28
hey kensupen, can you help me out here?
I'm making my own collision system for my car object which is temporarly a box , now I've made collision code for getting the good ground heigt, the good set off the wall for the N,E,S,W directions, now I want to add 4 diagonal lines, I can get the distance and stuff but how do position my object then? I guess I have to move it over the X & Z-as but how can I get the correct values for those?

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 4th Dec 2003 02:54
Car collision is a whole lot trickier than just a camera or person (one point) for good car collision, you need 4 points. Then you have to do all kinds of math for angles and other physics. I never attempted to do anything with that other than ground rotation.

This collision is meant more for a FPS shooter type game.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 4th Dec 2003 16:32
found a solution already, but not for your code, made my own

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram

Login to post a reply

Server time is: 2024-11-23 23:35:30
Your offset time is: 2024-11-23 23:35:30