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 / Collision isnt working. need help.

Author
Message
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 18th Jan 2009 17:23
i am trying to make collision i tryed this(which worked perfectly in a nothere, not so big game)


but if i try it i cant move, and i am away form the terrain

but i figured that if i remove this:


that i am not stuck the game runs perfectly, just there s no collision.

Game.Love
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 19th Jan 2009 07:37 Edited at: 19th Jan 2009 07:38
You only need to use dbAutomaticCameraCollision (0, 10, 1 ); for very simple collision and you only have to call it once before your game loop. Collision can be very tricky.

The reason you are moving away from the terrain is because the terrain is set to box collision, and therefore it moves the object away from it because it is colliding with the whole box. Use dbSetObjectCollisionToPolygons ( terrain object ) to make it polygon collision, This is VERY slow.

Maybe turn off the terrain collision, and then just use the Terrain Height way, as used in the terrain Tutorial and then only use collision for the "house" objects.

Most people prefer using Sparky's Mod for collision. But it still takes a bit of understanding to use it properly.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 19th Jan 2009 15:45
I kind the need colission for the terrain, and for the othere stuf.
if(andbody can show how to do it in sparkys or built-in==1
{
that woud be great
}


why i need coliision is becous i want gravity for the parrsuite and other stuf....

Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 19th Jan 2009 19:31
I think im right in saying that everyone uses sparkys as it is quicker and I think there maybe some bugs in the db collision.

Setup your objects:



Check for collision in main loop:



Remember to update objects every time they move(if they move):



As far as ground collision goes, RancidRat gives good advice.
But if you just want to get it up and running quickly you can just use SC_ObjectCollision() or
SC_InterceptObject() but this command is a little harder to use.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 25th Jan 2009 12:16
while, the collision dosent work if(it dosent stop)
but if i try
this

then it does exit the game.

Game.Love
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 25th Jan 2009 16:11
NNeed collision !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Game.Love
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 25th Jan 2009 23:59
Err, you didn't do anything if there is collision.

You should do something like

FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 26th Jan 2009 16:37
Coud you give me the full source i tryed something like this


but that only position me at the start x,y,z(0,0,0)

Game.Love
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 27th Jan 2009 09:55
Just save your old position in global variables. Example:

FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 27th Jan 2009 13:58
coud you give the full source.==??
plis

Game.Love
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 28th Jan 2009 11:22
Okey, I have to change my code a little bit:

FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 28th Jan 2009 14:33
what am i doing wrong==??
i cant get collision


Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Jan 2009 16:53 Edited at: 28th Jan 2009 16:54
Quote: "dbObjectCollision
This command will return a one if the two specified 3D objects are overlapping. If the second object number is set to zero, the number of the object overlapping with the first object will be returned as an integer value.
Syntax
int dbObjectCollision ( int iObjectA, int iObjectB )"



You have:


Also, the idea of having an x variable AND an ox variable etc..
is to hold values from the last loop, check collision, if (collision==1) then reposition object to old values of x etc...

Collision can be tricky, if you are still having problems, make a little collision example without any media(loaded models etc..), that way I (or anyone) can test your example and show you what is wrong.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 28th Jan 2009 17:40
why dosent this work

Game.Love
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 28th Jan 2009 18:23
vops, here is the code


Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Jan 2009 23:15 Edited at: 28th Jan 2009 23:36
Here it is:



I have not used the camera, as it is difficult to see if its working. I will edit-in another version later with camera collision.

EDIT:



Hope you like
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 15:02
Collision works but i kind of get stuck if i tuch an object(almos like none-sliding collisoon)

i think i have to update the objects position but i am not shure how to do that...
plis help


watch the video of what acsacly is hapining
IN this video i use a sphere as the main object for collision(1)
no an Cube but it is the sain

Game.Love
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 15:18
here is the part of the code


Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Jan 2009 16:38
Video download doesn't work.
In your code, how are your objects (camera) moving, you have missed:

FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 16:50
no note that, when i collide with an object sometimes i get stuck.. and evreything sort of shake
try to download the video now.
i will pos it again.
if this dosent work i wil put it on rapidshare.

Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Jan 2009 18:34
I download, but I get:-
Type: FILE, size: 0 bytes etc...
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 18:51
http://rapidshare.com/files/191209508/clip0016.avi.html



here it is

Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Jan 2009 19:36
Quote: "Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file."


Sorry about that, we'll have to do it without video.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 19:41
in the stuck.jpg picture if i am sort of like that(in the edge)
then i am stuck and its hard to get out(you just move for a litle an then jump back) also even in your example evreything seem to be doing this. also how can i make that you coud slide in an smaller angle???

Game.Love

Attachments

Login to view attachments
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Jan 2009 19:46
My example works perfect for me.
Did you try my example without any other media(your terrain etc...)?
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 20:04
Oh, then coud you plis make an terrain exalpe with a more complex object like this:
-in download

Game.Love

Attachments

Login to view attachments
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 20:24
what am i doing wrong(when i hit the bradley(download it from the previus tread)
your exampple is working fine, but i cant do it with my code

here is some of the code:


Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Jan 2009 20:43


Give me the terrain.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 29th Jan 2009 20:53
here is the new code the previus one was with out the terrain:


Game.Love

Attachments

Login to view attachments
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Jan 2009 21:29
Ha ha, I have put all media in the correct folders and I get this(see attachment).
I'm not sure whether I can help.
Do you know why its happening?

Attachments

Login to view attachments
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 30th Jan 2009 17:18
the collision dosent realy slide when i try it, i have try some thing
like:
dbGetCollisionX()....
but that just returns me.
Coud you plis make collision for the terrain example???
and make it to the bradley model i posted above.

Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th Jan 2009 18:00
I cant get your code to work properly(see post above).
There should be enough info in this thread for you to get it to work, collision is very difficult, if you are serious about collision I think you should switch to sparkys as db collision has some issues which may or may not be hindering you.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 30th Jan 2009 18:58
oh ok, then how do i make collision with sparkys dll==?

Game.Love
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th Jan 2009 23:35
Look at post above (19th Jan) and use the same principles,
--if collision, then place object to where it was last loop--

It will get alot more complicated than this depending on how you want your objects to react in a collision but there is enough info in this thread for you to make a good start.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 31st Jan 2009 09:32
what am i doing wrong??
when i collide it just is there, i cant get out.


Game.Love
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 31st Jan 2009 10:34
What I do is cast a ray down from the player and get the y co-ord and then add sphere sliding, it works fine but it needs some thinking on how to make you fall, etc.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 31st Jan 2009 11:01
em i dont realy now ray casting.

Game.Love
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 1st Feb 2009 18:50 Edited at: 1st Feb 2009 18:50
Um... There aren't that many functions in the sparky collision dll. Maybe this picture and the help docs will get you up to speed on Ray Casting.



--Jason

Attachments

Login to view attachments
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 1st Feb 2009 21:44
Good diagram jason!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Feb 2009 01:02
LOL... Well... Here is a code snippet I use for getting Ground Height using native Collision when not using Sparky or when I have such a huge terrain I don't want to wait for Sparky to analyze it:



And if you don't know HighestPointY and LowestPointY, you can always just plug in fairly Safe Values... perhaps:

HighestPointY = 5000;
LowestPointY = -5000;

That gives you a very roomy range... but you know how games are - its all relative.

Now.. Intersect Object is a form of Ray Casting. If you look close at the code... its making a Ray Cast DIRECTLY OVER the POSTION high Up, and Shooting STRAIGHT down like a Laser pointer. The Value returned is the distance the light/laser/ray travelled before it smacked into the ground. A little math and you have as decent ground height function

Please refer to my master thesis diagram above for reference!

Seriously - the only difference with Sparky's is that you need to set up your objects FIRST and the ray cast functions return alot more information... like the normal (and odd but effective way of describing the angle it smacked into the ground or other objects), it also lets you know the ObjectID of the Object you smacked into.

Additionally... when you ARE READY to get fancy.. sparky lets you shoot a RAY through multiple objects... like shooting a bullet through one person and hitting the guy behind that person (What? a .45 can do that! LOL). what you can do is ask sparky for information about each hit. But... We'll save that for another day


--Jason

@puppy of kosh - thanx Man!

FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 2nd Feb 2009 16:22
wow, jason who modeled the ragnger or. where did you get the reger i am daing to get my hands on some thing like that, maybe more green.

Game.Love
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Feb 2009 18:52
Character Shop Pro - Sold Here.

You can "Play" with the freeware trial one - but for all the animations available - you need to purchase it. Plus of course if you have the right sized models - you use it to bone-em-up

--Jason

Login to post a reply

Server time is: 2024-11-25 13:40:12
Your offset time is: 2024-11-25 13:40:12