Posted By: thrasher4556
Finding the angle of a wall - 06/18/03 03:05
How do I find out the angle of a wall or block? Like if my car is riding up hill and I want the car to tilt back or if one of the computer players is next to a wall I want his pan to be parallel to the wall. How do i do this?
Posted By: thrasher4556
Re: Finding the angle of a wall - 06/18/03 04:23
what is it listed under in the manual??
Posted By: Jason Bryant
Re: Finding the angle of a wall - 06/18/03 09:04
Check out trace in the manual. That should help.
Jason
Posted By: TAcker
Re: Finding the angle of a wall - 06/18/03 18:43
You have to work with NORMAL.
Get Normal by using TRACE or in the moment of a collision with a block.
the code is:
vec_to_angle(my.pan,normal.pan)
Posted By: thrasher4556
Re: Finding the angle of a wall - 06/19/03 13:02
Can someone explane normal to me: what it is what it does? Because I have been trying to understand it from the manual but it is not making any sence.
Posted By: Jason Bryant
Re: Finding the angle of a wall - 06/19/03 21:17
A surface normal is a vector of length 1 perpendicular to that surface.
Jason
Posted By: thrasher4556
Re: Finding the angle of a wall - 06/19/03 22:48
i know thats what it said in the manual but does that mean thta the vector holds the angle of the object that the trace event hit? Can you give me an example of what the normal would hold?
Posted By: Jason Bryant
Re: Finding the angle of a wall - 06/19/03 23:31
Example: If you send a trace toward the ground and the ground is flat (parallel with x and y axes) The normal from the trace would be the vector (0,0,1)... You can use the vec_to_angle command to compute the tilt and pan angles from the normal vector. This is my understanding... Please correct me if this is wrong.
Jason
Posted By: TAcker
Re: Finding the angle of a wall - 06/19/03 23:43
create an objekt with the MDLeditor.
OPTIONS -> SHOW NORMALS -> ALL
Look at the objekts triangles. On this faces are blue/white lines, which
are "standing" on an triangle. This lines are called "normals"
Posted By: kelly_b_c
Re: Finding the angle of a wall - 06/20/03 02:10
If you are asking about the concept of "normal" I might can explain that a little bit.
Normal basically means perpendicular. So the surface normal is a vector (like a line) that extends from a surface at a 90 degree angle.
Hmm, pictures would help I guess.
Imagine you have a surface representing a horizontal floor. The normal to the floor would be a vertical vector.
^
| <-- This vector is normal to the floor
|
_________ <-- This is suppose to be the floor
Or is you had a vertical wall, then normal to the wall would be a horizontal vector.
| <--This is the wall
|
|-----> This vector is normal to the wall
|
|
of course you can have a normal to any surface at any angle, these are just the simplest examples. Maybe that will help some, I hope.
Posted By: thrasher4556
Re: Finding the angle of a wall - 06/20/03 06:04
so the normal is 90 degrees all around the surface it is perpendiculat to? What exactly do you mean the vector is perpendicular to the surface? How is i perpendiculat ? you mean the values .x .y .z? or .tilt .pan . roll?
Posted By: thrasher4556
Re: Finding the angle of a wall - 06/21/03 03:12
I am making a race car bot and i want it to trace 100 quants ahead of it all the time and if it finds a wall to turn to the angle of that wall (be parallel to it), so i have this in a loop with a wait(1) at the end:
trace_mode = ignore_passable + ignore_models;
trace_to.x = my.x + (100 * cos(my.pan));
trace_to.y = my.y + (100 * sin(my.pan));
the_result = trace(my,trace_to);
if (the_result != 0) // if it found a wall
{
vec_to_angle(the_result_angle.pan, normal);
my.pan = the_result_angle.pan + 90;
}
then under that i have the code to move it foward according to its pan. It doesnt work. Can any one help?