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 → Small Math Problem.
Small Math Problem.
2004-03-10, 3:30 AM #1
Hi!
I'm making a little something where I create an object at a vertex in a sector, and I want it not to be like inside the wall, but a little outside. What should I use (VectorAdd, Sub, Scale, etc) and how? All I want is to move it out 0.05 JKUs towards the center of the sector the vertex belongs to.

/Edward
Edward's Cognative Hazards
2004-03-10, 6:49 AM #2
Hmm, if you have the vector of the sector center and the vector of the vertex (it's position), then you could do something like:
Code:
position = VectorAdd(vertexposition, VectorScale(VectorNorm(VectorSub(sectorcenter, vertexposition)), 0.05));

The VectorSub part results a Vector from vertexposition to sectorcenter. You normalize it, scale it to your desired length and add it to the initial vertexposition. The final resulting vector is the position you want the thing to be at.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-03-10, 7:46 AM #3
Thank you!
Edward's Cognative Hazards

↑ Up to the top!