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 → Thing Orientation and Vectors
Thing Orientation and Vectors
2005-07-23, 2:05 PM #1
Is there any way to roll(as in pitch, yaw, and roll) an object using vectors? Is there any verb at all to orient an object along that axis? I'm not looking for rotation verbs, but a vector verb that can do it.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-23, 3:08 PM #2
I'm confused. You want to rotate an object in a roll, without using a rotate verb? If I understand your request, what your asking is basically the same as asking us to move a door to a frame without using the frame verbs...

If I'm wrong, please correct me.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2005-07-23, 3:19 PM #3
Basically I'm looking for a verb that works like like SetThingLook, except "sideways". It's hard to explain. I don't want rotation because rotation takes gameplay time.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-23, 3:33 PM #4
Do you mean to set the object's pyr values?

Since Mots but not JK can do that (and assuming that's what you're trying to accomplish), maybe you can do somethign like this...
Code:
my_pyr = VectorSet(p, y, r);
dummy = CreateThingAtPos(dummy_tpl, my_sector, my_pos, my_pyr);
TeleportThing(my_object, dummy);
DestroyThing(dummy);
May the mass times acceleration be with you.
2005-07-23, 4:11 PM #5
I want to use vectors to define the pyr.

For example, a object with PYR of 0,0,90 will have a valid look vector at 0,1,0.
An object with PYR 0,0,0 still has a look vector at 0,1,0. No way to determine the roll.
What about a sideways vector perpendicular to the look vector?
A sideways vector for the first object would be at 0,0,1.
A sideways vector for the second object would be at 1, 0, 0.

See what I'm trying to do?
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-23, 7:10 PM #6
So, like this then?

[http://www.massassi.net/basics/images/thing1.gif]

If that snippet of code I gave you doesn't work, there's probably no way to do it in JK.
May the mass times acceleration be with you.
2005-07-23, 8:19 PM #7
That code will work and I noticed the second "vector" in fireprojectile will work too, but there isn't a good way to convert the vectors to angles in JK. I know about the patch, but I'd prefer if it'd work with all versions of JK. I was thinking there was some kind of complicated vector trickery that could do it.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-23, 11:11 PM #8
Here's an accurate COG implementation of sin that I wrote:
Code:
// degrees will be our input in degrees
// r is degrees in radians
// rSquared is r^2
// ans is our answer
// these should all be floats

// change the value of degrees if it's >360 or <-360
if (degrees > 360 || degrees < 360) {
   degrees = degrees % 360;
}

// now that neat periodic stuff, there are four checks
// it might be possible to reduce these into two but i'm too lazy
// and not sure it really matters
if ((degrees > 90) && (degrees < 270)) {      // if it's between 90 and 270, flip it over the line x = 90
   degrees = 180 - degrees;
} else if ((degrees < -90) && (degrees > -270)) {   // same thing but when it's negative
   degrees = -180 - degrees;
} else if ((degrees >= 270) && (degrees <= 360)) {   // the range from 270 to 360 is the same as -90 to 0
   degrees = degrees - 360;
} else if ((degrees >= -360) && (degrees <= -270)) {   // same thing but negative; -360 to -270 = 0 to 90
   degrees = degrees + 360;
}

// we're done with the periodic and repetitive stuff, convert to radians
r = degrees * 0.0174532925;   // might be a good idea to get this to more places?
rSquared = r * r;      // precalculate r^2 so it doesn't get done again and again, this is a big optimization (horner's rule)

// now do it!
ans = r * (1 - (rSquared * ((1/6) - (rSquared * ((1/120) - (rSquared * (1/5040 - rSquared * (1/362880 - rSquared * (1/39916800)))))))));

If you need cos as well, add 90 to the angle.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2005-07-24, 12:06 AM #9
Exellent! How did you come up with it? And what is the %? I've never seen that before.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-24, 10:48 AM #10
That's the modulo operator. It returns the remainder of a division. 8 % 3 = 2, 3 % 2 = 1, etc. Quite useful from time to time.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-24, 5:56 PM #11
arcsine would also be very very usefull
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman

↑ Up to the top!