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.

Newcomers DBPro Corner / My own collosion

Author
Message
Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 6th Jul 2004 06:17
Ok iam starting to see if I can make my own collision but the main thing I have run into thats a problem is how can I tell if one object is facing another object?

A 1 man team
EVIL SIG!
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 6th Jul 2004 22:52
To tell if object 1 is facing object 2 (as an example) I would use the following steps:

(1) Get the distances between the two objects.



(2) Get the angle between the two objects.



(3) Check if the angle is similar to the angle of the first object.



This code only takes the y angle into account but can be easily adapted for other angles aswell.

Hope it's helpful

Also, here it is as a function, it will return a 1 if object a is facing object b with a certain degree of tolerance:



Hope it helps
Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 7th Jul 2004 03:19
okie what the tolarence part mean?

A 1 man team
EVIL SIG!
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 7th Jul 2004 04:14
Basically, the tolerance is how many degrees off target the object doing the facing can be without being classed as not facing it.

If the tolerance was 0 then the angle of the first of object would have to be exactly the same as the angle between the two objects for it to be classed as facing it. The first object would have to point exactly at the centre of the target object.

If the tolerance was 15 then it means that the direction the first object is looking in can be off target by 15 degrees and still be classified as facing the target object.

Hope that explained it

Login to post a reply

Server time is: 2024-11-27 00:35:01
Your offset time is: 2024-11-27 00:35:01