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 → A question about ThingViewDot
A question about ThingViewDot
2001-04-05, 12:41 PM #1
When ThingViewDot(a, b) = 0, it means that thing a is facing 90 degrees away from thing b. But it doesn't help me determine which side of thing a thing b is! I'll be more specific: assuming thing a is the player, if 1 is returned, I know the player is facing the thing. If -1 is returned, I know the player has his back to the thing. But if it's 0, I don't know whether the thing is on his right or on his left!

Any ideas how I could check which side things are on?
Dreams of a dreamer from afar to a fardreamer.
2001-04-05, 1:17 PM #2
Check Sniper Arena. It has whether the bullet hit the left part or the right part of the body, meaning if the bullet is existing to the right/left of the body.

Mohican made me this script before.

Code:
	look = VectorNorm(GetThingLVec(player));
	velocity = VectorNorm(GetThingVel(bullet));
	cross = VectorCross(look, velocity);
	zComponent = VectorZ(cross);

	if(zComponent < -0.6) RArmShot = 1;
	else
	if(zComponent >  0.6) LArmShot = 1;


------------------
http://millennium.massassi.net/ - Millennium
2001-04-06, 12:19 PM #3
Thanks...

Well, I'm sure it works, but could you please explain to me how it works? I like knowing what sort of stuff I put in my cogs... [http://forums.massassi.net/html/wink.gif]

[This message has been edited by Fardreamer (edited April 06, 2001).]
Dreams of a dreamer from afar to a fardreamer.
2001-04-06, 4:26 PM #4
1. Get the normal for the player's look vector (normal is perpendicular line; if player was looking at a wall, it would be parallel)

2. Get the normal for the bullet's look vector.

3. No idea what the crossing vectors does.. I know this is where the 'calculations' occur, which decides whether it's on the left or the right.

4. Get the Z vector of #3's cross.

5,6,7. Basic if: statesments, deciding if the Z vector is large/smaller and sending off the regional damage message or whatever.

Hope that helped a little, maybe Hideki can clear things up (and I didn't make too big a fool out of myself!) [http://forums.massassi.net/html/smile.gif]

-Jipe
2001-04-06, 5:39 PM #5
Jipe thanks!
Actually I don't even still know what the heck was happeining in that part of the cog [http://forums.massassi.net/html/biggrin.gif]

------------------
http://millennium.massassi.net/ - Millennium
2001-04-06, 11:55 PM #6
Thanks Jipe! Actually I used to think the cross vector function returns a shared position, i.e. common point, but that wouldn't make sense, because two vectors don't always cross.

Maybe Mohican can explain... ?
Dreams of a dreamer from afar to a fardreamer.

↑ Up to the top!