About Store Forum Documentation Contact
Donations:
392$/mo



Post Reply 
Obtaining postion
Author Message
Ogniok Offline
Member

Post: #1
Obtaining postion
Hi!

How to obtain a world position that main character(Players[0]) is looking on?

I'm using this code, but it isn't working:
Code:
Vec pos;
Vec dir;

PhysHit physHit;

ScreenToPosDir(Vec2(0, 0), pos, dir);

if(Physics.ray(pos, (pos + dir * D.viewRange()) - pos, &physHit))
{
    LitSquad->soliders[0]().mustMoveTo(physHit.plane.pos);
[...]

Solider is moving to my position. Always. What's wrong?

Sorry for my english. smile
02-04-2011 08:37 PM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #2
RE: Obtaining postion
try offsetting the position of pos to something higher then its legs.

pos -= Vec(0, 1, 0);

try LitSquad->soliders[0]().mustMoveTo(physHit.plane.pos - pos());


try just dir * D.viewRange() in the second parameter of Physics.ray
02-05-2011 08:24 AM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Obtaining postion
Maybe physHit point on player first. Use callback to exclude him.
02-05-2011 01:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Ogniok Offline
Member

Post: #4
RE: Obtaining postion
Thanks. This is working for me:

Code:
if(Physics.ray(pos, dir * D.viewRange(), &physHit, ~IndexToFlag(AG_CONTROLLER)))
02-05-2011 04:07 PM
Find all posts by this user Quote this message in a reply
Post Reply