|
Rotations
Sept 5, 2017 12:54:11 GMT
via mobile
Post by darkhavoc on Sept 5, 2017 12:54:11 GMT
How do i make something rotate to face up and down say i wanted to make the skinmesh of the fish turn to face itself pointing in the sky and the towards the ground how would i do it?
|
|
|
Post by Power Supersport on Sept 5, 2017 13:14:10 GMT
Quaternion is the data class used for storing rotations. You can use iQuaternionFromEulerAngles () to set euler angles in a quaternion. Euler angles are simply rotations on x, y and z axes. Here's an example script
Quaternion rotation; void Main () { iQuaternionFromEulerAngles (rotation, 0, 90, 0, "xyz"); iObjectOrientationSet (OBJ_0, rotation); } This script will set the rotation of OBJ_0 to 90 degrees on the Y axis. You can now set the rotation you desire for the fish.
|
|
|
Rotations
Sept 6, 2017 3:02:49 GMT
via mobile
Post by darkhavoc on Sept 6, 2017 3:02:49 GMT
Sounds great and just to clarify it rotates it fluently not just clicking from position to position correct???
|
|
|
Post by Power Supersport on Sept 6, 2017 6:52:27 GMT
No, it doesn't. You have to use another function for that, called iFloadTendTo (reference, begin, end, speed, mode)
float x = iFloatTendTo (x, x, 1, 0.2, 0); Usually the first two values are the same variable as in this example.
|
|
|
Rotations
Sept 6, 2017 6:58:04 GMT
via mobile
Post by darkhavoc on Sept 6, 2017 6:58:04 GMT
Ok awesome just what i needed thank you
|
|
|
Rotations
Sept 7, 2017 10:08:06 GMT
via mobile
Post by darkhavoc on Sept 7, 2017 10:08:06 GMT
Sooo... Forgive me its been forever since ive toyed with all this what was a good working example of an upwards rotation if you dont mind....i was just a bit lost in working trying to combine those 2 command youve given to me
|
|
|
Rotations
Sept 7, 2017 10:08:55 GMT
via mobile
Post by darkhavoc on Sept 7, 2017 10:08:55 GMT
Er not combine sorry wrong word i meant the ifloat one is where i got a bit lost
|
|
|
Rotations
Oct 23, 2017 11:09:19 GMT
via mobile
Post by darkhavoc on Oct 23, 2017 11:09:19 GMT
Ok so after a whole minute i began to look into this a bit more but im still unsure of what to set the reference to ?? Is it along the X,y,z axis system or is it a point near the thing rotating relevant to something else??? This still confuses me would you mind lending me a hand here( sorry not trying to sound to bothersome)
Also does IN_XX go after the first float nefore it says ifloattendto or is that something else....
|
|
|
Post by TinSoldier on Oct 23, 2017 16:04:57 GMT
|
|
|
Post by darkhavoc on Oct 27, 2017 9:20:14 GMT
alright this does rotations n all but ow do I change the axis that it rotates do I sim0ly turn all the "x" s into "y"s or "z"s or am I missing something here the goal would be to get a "frontflip" out of it at best sorry if im being rather picky how do modify that code to rotate on a different axis than the one it does by default??
|
|
|
Post by indiedev on Oct 27, 2017 12:49:23 GMT
maybe just try swapping like you said and see what happens, it's all trial and error and nobody knows exactly what you want except you...
|
|
|
Post by TinSoldier on Oct 27, 2017 15:54:16 GMT
_basicY roatation001.3dr (138.62 KB) try this project, you can adjust all 3 values as needed by pressing a key, press leftshift at the same time to reset that axis to 0 degrees rotations. Cant be anymore basic then this so study it, play with it.
|
|
|
Post by TinSoldier on Oct 27, 2017 16:16:44 GMT
Here's a little extended info, just to twist your brain a bit.
iQuaternionFromEulerAngles (rotation, 0, 90, 0, "xyz"); In this function above you'll see the string "xyz" .
This strings purpose is to tell the function in what order to process the 3 float values for (x,y,z).
I believe the idea is to allow us to use text string scripting or text manipulation to change the order of processing if needed.
So to test this, just swap the text values around and see the rotations change,
for example - use "yxz" or "zxy" or "yzx" or "xzy" or "zyx"
MIND BLOWN !
|
|
|
Post by darkhavoc on Oct 29, 2017 9:05:01 GMT
yeah Mind BomB XD
|
|
|
Rotations
Oct 30, 2017 8:33:33 GMT
via mobile
Post by darkhavoc on Oct 30, 2017 8:33:33 GMT
Sweet so now using the code provided in those projects ive rigged up a 3rd person user-controllable camera that moves with WASD its not as fluent when goin from rotating left to right but i figure itll work for now ... If anyone wants to mess with the code n try to make it not snap when going left then right or up then down (youll know what i mean if you saw it) but EURIEKA IT WORKS ITS ALIVE AHAAHAHHA nah Jk frankenstien moment there XD Thanks yall for the help i really appreciate it and good luck to ya in your current game projects
|
|
|
Post by TinSoldier on Oct 30, 2017 17:23:27 GMT
So why didn't you add a link so anybody can take a look, that's what you're asking.. right ? .
|
|
|
Rotations
Oct 30, 2017 22:37:53 GMT
via mobile
Post by darkhavoc on Oct 30, 2017 22:37:53 GMT
Sorry i fell alseep ill get it up here in a minute
|
|
|
Post by darkhavoc on Oct 30, 2017 22:49:04 GMT
Here it is SO sorry it took me so long to get it posted
|
|
|
Rotations
Oct 31, 2017 6:12:13 GMT
via mobile
Post by darkhavoc on Oct 31, 2017 6:12:13 GMT
So yeah if you wouldnt mind takin a look at it i put a textprint explaining the issue in the project so it shouldnt be too much i y Toyed with the vslues a bit and it still was really "snappy" wasnt sure if there is any fix for it
|
|
|
Post by TinSoldier on Oct 31, 2017 14:44:36 GMT
So the problem was to smoothly rotate, one of the functions need to work in reverse. To fix it you just reverse the direction of values like this - To turn left the function use's 0 to 360 To turn right the function use's 360 to 0 In the first version only one direction of movement was defined for each axis, you added both directions, so one function needs to work in reverse, like adding 1, and subtracting 1 To keep it simple and not change what you've supplied to much, the simple solution was to reverse the function values, and the reset value as well. Third person Camera ControlA.3dr (138.89 KB)
|
|