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 → VectorDot(), an ode to thee...
VectorDot(), an ode to thee...
2004-12-13, 12:37 PM #1
VectorDot(); I can't express how much I love you, for your use in caluculating an angle, for your use in orientating things properly, for your use for anything imainable.

Here's something I whipped up while working on my menu camera code:

Code:
//Position that the camera will keep behind the player along LVec thanks to 0x8 attachment.
Position_Vec = VectorSet(0.0, -0.4, 0.14);

CamYPos=VectorScale(GetThingLVec(DPlayer), -0.4);
CamZPos=VectorScale(GetThingUVec(DPlayer), 0.14);
NewCamPos=VectorAdd(CamYPos, CamZPos);
NewCamPos=VectorAdd(GetThingPos(DPlayer), NewCamPos);
CamNewDist=VectorDist(NewCamPos, GetThingPos(FlightCamera));

SetThingVel(FlightCamera, VectorScale(VectorSub(NewCamPos ,GetThingPos(FlightCamera)), CamNewDist));
DotP=VectorDot(GetThingUVec(FlightCamera), GetThingLVec(DPlayer));
DotY=VectorDot(GetThingLVec(FlightCamera), GetThingRVec(DPlayer));
TempVec=VectorAdd(GetThingUVec(FlightCamera), GetThingPos(FlightCamera));
TempVec=VectorScale(VectorSub(TempVec, GetThingPos(FlightCamera)), -1);
DotR=VectorDot(TempVec, GetThingRVec(DPlayer));
DotVector=VectorSet(360*DotP, 360*DotY, 360*DotR);
SetThingRotVel(FlightCamera, DotVector);


What this does, is move the camera thing, which is attached to the DPlayer thing. DPlayer is a dummy actor that is rotated according to the menu cursor co-ords, and how far away from the center the cursor is. (Flight mechanics like freelancer)

Well, this is the camera code that orientates the camera properly for a 3rd person camera, when the thing the camera should be following is rotating all around the place. (dunno how 1st person reacts to being rotated all over)

Thank you VectorDot(), I'd have man babies with you, but you are a 0's and 1's, and I am flesh. :p

[Theres a slight bug where if the thing is attached, and you rotate, due to 0x8 attachment, the camera doesn't align itself to the LVec of the player, easily compensated for though. The SetThingVel() is pretty much in vain I do believe, I was using that before I stuck in the 0x8 attachment.]
-Hell Raiser
2004-12-13, 5:47 PM #2
I think I should just send you my freelancer mod (in it's buggy, crashy state) since getting it to rotate using my method is a simple matter of
Code:
flpilot=VectorSet(zvector*3157.5, xvector*-2400, VectorZ(GetThingRotVel(shuttle)));

SetThingRotVel(shuttle, flpilot);

The 3157.5 and 2400 are just variables to make the ship turn at the rate I want it to. (BTW, the (z/x)vector variables were defined in the mouse code I posted in your other thread.)
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-12-13, 7:23 PM #3
Coupled with SM's code, we could have some kick-*** space piloting levels. It'd also help as far as the crappy orientation goes.

JediKirby
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-12-14, 3:54 AM #4
Quote:
Originally posted by SG-fan
I think I should just send you my freelancer mod (in it's buggy, crashy state) since getting it to rotate using my method is a simple matter of
Code:
flpilot=VectorSet(zvector*3157.5, xvector*-2400, VectorZ(GetThingRotVel(shuttle)));

SetThingRotVel(shuttle, flpilot);

The 3157.5 and 2400 are just variables to make the ship turn at the rate I want it to. (BTW, the (z/x)vector variables were defined in the mouse code I posted in your other thread.) [/B]


Buggy, crashy state eh? What does your Freelancer mod consist of? Just menu code and flying a ship around?
-Hell Raiser
2004-12-14, 6:19 AM #5
You can fly in in all axis, shoot, turn on/off hardpoints, cruise, engine kill, reverse, use free flight (mouse doesn't control direction), and 1st/3rd person cameras for the ship.

The buggyness started when I added shields and hull. Now when you die the ships don't properly respawn. Any destroyed ship will cause the game to crash if you use it.

The mouse controls where the weapons are shot, but I tweaked something I didn't like making the weapons have the ships velocity (thus not hitting where you shoot) but it's low on my fixing list.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-12-14, 6:33 AM #6
Ah, so you're much further ahead in any kind of playable mod than I. That works, cuz I'm so friggen busy with other stuff. :)

Any ideas where the crash is occuring in the code? Do you need any 3rd party code checking? :)
-Hell Raiser

↑ Up to the top!