#### Archived

This topic is now archived and is closed to further replies.

# Free flying tutorial

This topic is 5718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''ve been looking at the radar class in this game tutorial, and I just dunnot understand one part of this code.

{
VECTOR3D deltaPos, v;

//Compute coords of object relative to the actor

deltaPos = pos3D-actor->worldPos;

//Normalize that

deltaPos.Normalize();

//Distance of blip from center of radar is cosine of angle

//between view direction and direction to object

//Determine projection of object on plane perpendicular

//to viewing plane

//Handle special case of null v, meaning object is on

//line of sight

if(v.IsNull())
{
return true;
}

//Else normalize v

v.Normalize();

//v is now a vector from the actor''s viewpoint to projection

//of object on the actors''s plane. Compute angle from actors''s

//up vector to object

//Convert to cartesian

return true;
}

Could someone please explain the code after the "//convert to cartesian" comment. What is rT = 1.0f-radarR/2.0f for? radarR is the dot product of the look at vector and a vector from the players position to the enemys position.. I understand that this code is to get the 2d cords on the radar, but still don''t follow those last 3 lines.. Thanks a bunch.

##### Share on other sites
take a few 3D points and a calulator(maybe even a graphing one) plug it in, and watch what happens, you might get some messy numbers, but at least you will understand what happens and be able to follow it. It works for me.

Out - The Prox
-------------------
Remember: No shortcuts...
They may be faster, but someday you will be penalized.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633736
• Total Posts
3013601
×