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.

DLL Talk / -NGC- Testing for collision with two objects at once

Author
Message
Indie Rock 13
19
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 3rd Feb 2005 11:25 Edited at: 3rd Feb 2005 11:26
I have been using this method to test collision for my game

CollCount=CountCollisionsPro(1)
if CollCount>0
Obj=CollisionHitObj(1,1)
if obj=2 then jumpy#=0.0 and gravity#=0.0

But how would I be able to test if Object 1 is colliding with two other objects at once? At the moment if you jump against a wall and slide down it holding the direction against the wall then when you hit the ground the gravity variable continues to grow negatively. If I could test for collision with the wall and the ground then that would be alleviated...

Or could I just alleviate this problem entirely and be able to have my object slide down walls that are too steep or straight up and down rather than sticking to it?



Neeeeeeeewom!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Feb 2005 15:17
Assuming you have different object numbers for your floor and ground, you can try something like this.



Indie Rock 13
19
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 3rd Feb 2005 18:31 Edited at: 3rd Feb 2005 18:41
Well, I ended up getting it to work with a workaround method, but I was wondering something about NGC v.3.1 that would make it work more smoothly. Can you do Poly to Poly collision instead of just Ellip to Ellip or Ellip to Poly? I only see those two listed in the headed #Constants...

Thanks!

EDIT- nevermind... my new method still doesn't work. I made a box object as my main objects base and made its coordinates always stay the same as the main objects. This way I planned to be able to tell where the bottom is touching as well as the sides... the number of the box the main object is colliding with being obj and the base object being obj2... but for whatever reason when pressing against a wall while on the ground both obj's always show the same object number and gravity# continues to drop still.... I'm running out of ideas!

Neeeeeeeewom!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Feb 2005 18:54 Edited at: 3rd Feb 2005 19:10
If you remove the roof code from mine and just use the ground and wall it should work. I'll do a test code later But I have gotta sleep now. It should work. When wallhit = 1 you are hitting the wall/main level. When groundhit = 1 you are hitting the ground.

Make sure and change the

wall =
ground =

to be your object numbers.

I just seen you are using NGC 3.01 I haven't tested it with that yet as I went back to 2.03, 3.01 is wicked buggy. I'll try and do a small example code before I go to work. Can't make any promises though ... 999 out of 1000 I'm late for work

[edit] I think 3.01 can do poly to poly collision but it is left out of the wrapper for now as I think it too may be bugged. Hopefully they will come out of hiding and fix these problems soon.

[edit2] I know I will be running late so here is a modified example from the NGC examples. It is the multi_ellip example modified. The left ellip is the wall and the right is the ground.



BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Feb 2005 19:14
Yes, Poly to Poly is supposed to be on the way, but not here yet.

You should be able to do what you want with Ellip - Poly. Lost in thoughts code is exactly what you need.

Just in case you missed what he's doing, CountCollisionsPro does exactly what it says on the tin. If you hit 2 things, the value is 2, if someone blasts you with an elephant gun, the value will be 100 as all the pellets embed themselves in your ass.

You need to replace your Obj=CollisionHitObj(1,1) with a loop that checks all collisions, not just the first one.

BatVink
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Feb 2005 19:58
Nuclear Glory info from the forums, 16th Jan 2005:

Quote: "Give us a few days to get things turned around folks. What we have in store should make up, considerably, for the lack of performance"


Quote: "The collision system is going to be "reloaded" and should not only fix the octree problem and deliver on everything promised, but should come loaded with some new secret weapons as well. (I'm not telling until she's out)
"


BatVink
Indie Rock 13
19
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 4th Feb 2005 17:11
Hmm now I get it. I may mess with that some more but I got mine to work the way I wanted, halfway on accident though. Now Im going to fiddle with adding my model and animations in the code and see how much I can screw it up. I'll probably be making a new post soon

Neeeeeeeewom!

Login to post a reply

Server time is: 2024-04-25 03:22:40
Your offset time is: 2024-04-25 03:22:40