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 → HEKLO! I need YOUR help!
HEKLO! I need YOUR help!
2002-01-15, 6:50 AM #1
Okay, i made a controllable flying pad thingy... It moves where you want in X/Y, but not in Z axis, so how would i make it so that the pad is tilted to the exact direction you look at? Velocity or whatever that is. [http://forums.massassi.net/html/smile.gif]

------------------
Life is like... skating... yeah, skating is a good example. You see someone skating and think "Hey, that looks like fun and easy!". You go and buy a skateboard and try, you get a few broken bones, asphalt-face and stuff... But hey, i'm not the one who gets hurt!
Last edited by mb; today at 10:55 AM.
2002-01-15, 7:04 AM #2
I had to do that with my Guided Rocket too. It was kinda tricky, and it wont sync in multiplay, But for single play it should work fine...

Add a:

thing dummy local
template temp=ghost local
vector lVec local

to your symbols section, And add this somewhere in the code to find the vector:

dummy = FireProjectile(player, temp, -1, -1, '0 0.01 0', '0 0 0', 0, 0, 0, 0);
lVec = VectorNorm(VectorSub(GetThingPos(dummy), GetThingPos(player)));
DestroyThing(dummy);

That'll store the players headpitch in the vector. Now you can just use:

SetThingLook(pad, lVec);
SetThingVel(pad, lVec);

That will rotate the pad to face forward and give it a forward velocity, which ever way your facing. You may want to scale the lVec first though, It may not be the speed you want.
2002-01-15, 8:08 AM #3
No need for all that Vector work, just use:

Code:
lvec=GetThingLVec(dummy);


Some coggers thought that the z axis of the lvec didn't work, but they confused headpitch with lvec.

------------------
More matter with less art.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-15, 9:00 AM #4
err... Headpitch is exactly what doesn't work... [http://forums.massassi.net/html/mad.gif]

thanks, whoever, i'll try that [http://forums.massassi.net/html/smile.gif]

------------------
Life is like... skating... yeah, skating is a good example. You see someone skating and think "Hey, that looks like fun and easy!". You go and buy a skateboard and try, you get a few broken bones, asphalt-face and stuff... But hey, i'm not the one who gets hurt!
Last edited by mb; today at 10:55 AM.
2002-01-15, 9:16 PM #5
To give a natural force to the thing that you want to look as the player looks, use ApplyForce. If you put that in a pulse, it will add the force to the looking direction slightly by slightly and eventually makes it look that way. Looks very natural.

------------------
http://millennium.massassi.net/ - Millennium
2002-01-15, 9:20 PM #6
Lordvadar is right , thats the only verb you need...

lvec=GetThingLVec(Player);

lvec would equal some num like this, (0, 0.556556, 0);

FireProjectile(ghost, bla bla ....

lvec=GetThingLVec(dummy);

lvec would equal some num like this, (0, 0.556556, 0.34546);

VectorX is I guess Roll ??? , not used for player.
2002-01-15, 9:26 PM #7
LVec is funny that both x and y changes as the player turns around.

I guess it was like if both x and y are added, they'll be 1. Maybe I don't remember it right though.

Never z though.

------------------
http://millennium.massassi.net/ - Millennium
2002-01-16, 6:04 AM #8
Was that mad smiley directed at me, Cavey? Then I'll explain.

I meant that you should replace Aeon's vector work with the line I wrote. Like this:
Code:
dummy = FireProjectile(player, temp, -1, -1, '0 0 0', '0 0 0', 0, 0, 0, 0);
lvec=GetThingLVec(dummy);
DestroyThing(dummy);

The same answer with cleaner code.

---

The lookvector that GetThingLVec(player) returns is the direction in each axis that the player is looking. And it's in x,y,z form.

The z axis is how much the player is looking up - not counting headpitch. If you want to test that try this:
Code:
SetThingLook(player, '0 0 1');


And if you print the lvec after that, it will look like this: '0 0 1'.

The x and y axes show how much the player is looking in each axis. If the player looks straight along the y axis his lvec would look like this: '0 1 0'. If he looks down the x axis his lvec looks like this: '1 0 0'.

Also, the lvec is normalized. That is, the lvec has a vector length of 1.

----

Strangely, when the player walks around as normal, he does have a z axis value in his lvec(this is not the headpitch). It's very small but it's there none the less. And when the x and y axes become even (at '0.7x 0.7x 0') the z axis becomes exactly zero. [http://forums.massassi.net/html/confused.gif]

[edit]

An lvec gives a thing a direction to look in, but it does not decide the orientation of the thing. For example, the player could look in the same direction whether he was standing on his head or not. So an lvec cannot be used to make an actor look upside down. That was the problem with HR's headpitchable flight.

[This message has been edited by SaberMaster (edited January 17, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-17, 5:56 AM #9
I know how lvec works... but i need to know how to copy the players headpitch and give it to a thing...

------------------
Life is like... skating... yeah, skating is a good example. You see someone skating and think "Hey, that looks like fun and easy!". You go and buy a skateboard and try, you get a few broken bones, asphalt-face and stuff... But hey, i'm not the one who gets hurt!
Last edited by mb; today at 10:55 AM.
2002-01-18, 1:09 PM #10
Hey, Hideki, I've always wanted to ask this; are you the holder of a title like "World Authority on COG?" [http://forums.massassi.net/html/wink.gif] I mean, where did you learn SO much? [http://forums.massassi.net/html/eek.gif] [http://forums.massassi.net/html/wink.gif]

By the way; love Sniper Arena, love Enhancement Pack 2.1 and all your other stuff rocks. [http://forums.massassi.net/html/wink.gif] I'm looking forward for whatever JK2 goodies you've got in store [http://forums.massassi.net/html/wink.gif] (was it JK2 you said you'd edit?) [http://forums.massassi.net/html/confused.gif]

------------------
You have the right to remain silent. Exercise that right.

We are the forum junkies who say "Ni, Ni-mail us!"
A slightly more stripy Gee_4ce, and more than just Something British...

Visit the home of Corporal G on the Internets

↑ Up to the top!