Ask a Question related to Macromedia Director 3D, Design and Development.
-
AndrewNock #1
ModelsUnderRay - show direction?
Hey all, before i spend a bit of time on this, wanted some input, and to see if
anyone has done anything.
I have got a few objects sending out rays for collision detection, but
sometimes unsure where they are going and what direction etc. I want to make
something that small cylinders will be made in the direction and for the
distance of the ray.
Any ideas?
Andy
AndrewNock Guest
-
ModelsUnderRay
Hello, I've just learnt the ModelsUnderRay technique for collision detection from the UNSW tutorial and have checked various sites to make sure... -
modelsUnderRay Help please!
if i wanted to make sure a round table did not collide with a ball using modelsUnderRay would i have to use a bounding box,(as i imagine the result... -
modelsUnderRay help needed
Hello i want to cast modelsUnderRay in a flight simulator like game. The aircraft is moving always in 3d and i need to check the area around the... -
modelsunderray ba*d!
I have a couple of issues here. 1: I have a character proxy model that I controll around a 3D world. Using modelsunderray I am trying to detect... -
ModelsUnderRay ... again, again, again.
English: Hi! Someone it has worked with the command modelsunderray in worlds where the walls do NOT BE necessarily oriented in the axes X and AND... -
duckets #2
Re: ModelsUnderRay - show direction?
Hi Andrew,
(After typing this up in notepad, I accidentally posted it in response to your
crane question instead of this thread!)
To align a model to a vector (such as your ray cast vector), you can use
something like this:
tiltAngle = vector(0,0,1).anglebetween(theVector)
tiltVector = theVector.perpendicularto(vector(0,0,1))
theModel.transform.rotation = vector(0,0,0)
theModel.transform.rotate(rayBeam.transform.positi on,tiltVector,-tiltAngle)
To align it to a ray vector, and display it correctly, if your model was a
'box' from director's default box primitive, you would then want to position it
halfway between the ray cast source, and the ray intersect position (because
the box's origin is in its centre), and scale it so that it extends the full
distance between the two.
Luckily this is actually a frequently asked question, and something that I do
quite a lot myself - so I happen to have some demo movies showing it in action!
First here's some roughly compiled information about modelsUnderRay(), mostly
advice I've given out on various director mailing lists in the past:
[url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/mode[/url]
lsUnderRay.txt
And here are a few demos of how it can be used effectively (including one with
visible beams as you described!)
[url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/grou[/url]
ndCollision.htm
[url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/grou[/url]
ndCollisionAndAlign.htm
[url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/grou[/url]
ndCollisionAndAlignInterpolated.htm
[url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/wall[/url]
Collision_V-Ray.htm
[url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/wall[/url]
Collision_V-Ray_visibleBeams.htm
Enjoy!
- Ben
duckets Guest



Reply With Quote

