Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Getting position a certain length from an actor
Getting position a certain length from an actor
2001-08-30, 6:21 PM #1
I need to find a vector position several JKUs in front of the moving direction of an actor or player. It has to be in the direction the actor is moving, because AI don't always look where they are going.

------------------
Truth is in the eye of the beholder
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-08-30, 9:01 PM #2
I'm not an expert, maybe this is useful:

thrust = GetThingThrust(player); // Gets the vector
if (VectorX(thrust) > 0) ... //Going right
if (VectorX(thrust) < 0) ... //Going left
if (VectorY(thrust) > 0) ... //Going forward
if (VectorY(thrust) < 0) ... //Going backward

hmmm... maybe is not exactly what you want to know...

[This message has been edited by Nemios (edited August 31, 2001).]
"May the SourceCode be with you..."
Nemios, MOD developer.
2001-08-31, 7:47 AM #3
No, that's not what I need, but thanks anyway.

I have the position of an actor, and a lenth somewhere between 0 and 2 JKUs. I need to add the lenth to the position of the actor and get a new position somewhere in front of the actor. So, if the actor was at 0,0,0, the lenth was 1 JKU, and the actor was moving(not looking) down the y axis, then the new position would be 0,1,0.

What cog verbs should I use to do that?

------------------
Truth is in the eye of the beholder

[This message has been edited by SaberMaster (edited August 31, 2001).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-01, 2:29 AM #4
You'd fire out a ghost projectile. Set a pulse that checks the distance between it and the player every .001. When it's equal to the destination distance, create a ghost at that position and destroy the projectile. Then you have your pos.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2001-09-01, 10:42 AM #5
Then you can't get the position by manipulating vectors? Anyways, I try it out. Thanks.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-01, 7:42 PM #6
No, firing a projectile won't work. I need the vector calculated instantly because up to twenty timers in one cog will need the vector within .01 seconds.

------------------
Truth is in the eye of the beholder
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-01, 9:45 PM #7
Here ...

Code:
pace = VectorScale(GetThingVel(person), 1.0);
moved = VectorAdd(GetThingPos(person), pace);


Then if you want to create a thing at that position use this ...

Code:
dummy = CreateThingAtPos(ghost, GetThingSector(person), moved, '0 0 0');
2001-09-02, 8:34 PM #8
Thanks, *_Seifer_*, that works fine.

------------------
Truth is in the eye of the beholder
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-03, 6:13 PM #9
No problem.

↑ Up to the top!