HugePinball Posted December 13, 2010 Share Posted December 13, 2010 Yes, I was going to say that those calculations were based only on your fixed sample tilt angle of 45 degrees, and that the variations in the x and y angles aren't going to be linear. I was wrong that I had this completely worked out before. I think I had it close, but something was off in one or more of the quadrants around the z axis, and I ended up putting the problem it aside and not worry about the tilt (it was not going to be much more than a cosmetic improvement for my purpose anyway). What code I did have for that is likely in a backup file that I still haven't found. The thing about trying to do complex rotations like this is that the system the game uses for them (or rather, the system available to use through script) is far from intuitive. Above when I said "Because of how SetAngle works", I was referring to the rotational coordinate system being used. Part of my problem finding a solution is that I don't really know what this reference system is called formally, so I'm not sure where to look for reference. To try to describe it: the x rotational axis is always parallel to the world x-axis, the y rotational axis is perpendicular to the x rotational axis, and the z rotational axis is perpendicular to the y rotational axis; also, the z rotational axis is always the same as the object model's own z-axis. Again, the best way to understand what I just said is to use Feng Shui and experiment rotating some object with the visible axes turned on (and guess what? there's a version you can use in New Vegas now). This picture should show you how that will be able to help visualize what's going on. There will definitely be some trig functions in the script calculations. I have a feeling something here will be relevant. Link to comment Share on other sites More sharing options...
HugePinball Posted December 13, 2010 Share Posted December 13, 2010 Replying to this here so as not to bump the other thread up again: Ah, that sounds good. I tried it several different ways now and i felt the other thread might be confusing. I don't think there's any way around that :P i did check out feng shui and it didn't have any answers for me. in feng shui you still rotate objects on the world axis, not sideways from the player's heading, unfortunately.The thing is, as I explain briefly in the post above, only rotations on x (SetAngle x ##) rotate around a world axis, or more precisely, about an axis parallel to the world x-axis (for convenience I'll just call this the world x-axis, and likewise with lines parallel to y and z world axes). Rotations on y or z are never around the y and z world axes except under specific conditions. I really don't want to write them all out - if you play with the rotations using Feng Shui, it should become obvious with a little attention. My suggestion above allows you to sidestep all this by starting with a different orientation of the model, but as you saw it only gives you two degrees of freedom. If you want all three, we'll have to figure out these formulas... Link to comment Share on other sites More sharing options...
TallgeeseIV Posted December 13, 2010 Author Share Posted December 13, 2010 My research on the topic shows the same thing, I found this page for Second Life that describes different types of rotation systems, http://wiki.secondlife.com/wiki/Rotation And I found a ton of pages about unity game engine scripting to do this but it provides a hell of a lot more useful functions than the geck does. i really appreciate you trying to help me on this. Link to comment Share on other sites More sharing options...
TallgeeseIV Posted December 13, 2010 Author Share Posted December 13, 2010 Replying to this here so as not to bump the other thread up again: Ah, that sounds good. I tried it several different ways now and i felt the other thread might be confusing. I don't think there's any way around that :P i did check out feng shui and it didn't have any answers for me. in feng shui you still rotate objects on the world axis, not sideways from the player's heading, unfortunately.The thing is, as I explain briefly in the post above, only rotations on x (SetAngle x ##) rotate around a world axis, or more precisely, about an axis parallel to the world x-axis (for convenience I'll just call this the world x-axis, and likewise with lines parallel to y and z world axes). Rotations on y or z are never around the y and z world axes except under specific conditions. I really don't want to write them all out - if you play with the rotations using Feng Shui, it should become obvious with a little attention. My suggestion above allows you to sidestep all this by starting with a different orientation of the model, but as you saw it only gives you two degrees of freedom. If you want all three, we'll have to figure out these formulas... Yep, looks like it. And I can't give up on this. If we can figure this out, well, a whole lot of new mods come to mind. you could make tires on a new vehicle spin forward and backwards based on your speed, in the direction you're going, and even pivot them left or right with your steering. Link to comment Share on other sites More sharing options...
HugePinball Posted December 13, 2010 Share Posted December 13, 2010 Yep, looks like it. And I can't give up on this. If we can figure this out, well, a whole lot of new mods come to mind. you could make tires on a new vehicle spin forward and backwards based on your speed, in the direction you're going, and even pivot them left or right with your steering.Well, in general I think that kind of thing is done more efficiently with animations, but that's not my area. This type of scripting still has its uses though. Incidentally, my intended use was for the green scaling arrows in Feng Shui. If you go into scale mode and move around the object you'll see that the arrows always face you but only on a horizontal plane. I think you can see why making them track you up and down as well wasn't really worth the effort ;) Link to comment Share on other sites More sharing options...
TallgeeseIV Posted December 13, 2010 Author Share Posted December 13, 2010 (edited) Yep, looks like it. And I can't give up on this. If we can figure this out, well, a whole lot of new mods come to mind. you could make tires on a new vehicle spin forward and backwards based on your speed, in the direction you're going, and even pivot them left or right with your steering.Well, in general I think that kind of thing is done more efficiently with animations I make my own models but I haven't played with object animations... I couldn't find a solution to exporting character animations from Max so I just assumed you couldn't make animated objects either... I'll have to look into that. If i animated the tilt left and right, i could make it tilt left and right, and use your method to tilt it back and forth, then i could have diagonal tilts too... hmmm, i like this idea! oh, and btw, i should have said so before but i was kind of in a rage at the time, something about spending all my free time after work for a whole week on a math problem got under my skin, haha. but after seeing feng shui in action, you're a genius. brilliant mod, i'm impressed Edited December 13, 2010 by TallgeeseIV Link to comment Share on other sites More sharing options...
reaperg92 Posted December 14, 2010 Share Posted December 14, 2010 Ok, why make a script to do this? If you want the object to point down all the time, why not just edit the mesh to do so? Link to comment Share on other sites More sharing options...
TallgeeseIV Posted December 14, 2010 Author Share Posted December 14, 2010 Ok, why make a script to do this? If you want the object to point down all the time, why not just edit the mesh to do so? you.... you didn't read everything, did you...? it's got to be level most of the time, facing the direction the player is, then tilt forward, backward, left and right slowly as i call it to. Link to comment Share on other sites More sharing options...
HugePinball Posted December 14, 2010 Share Posted December 14, 2010 (edited) Ok, why make a script to do this? If you want the object to point down all the time, why not just edit the mesh to do so?You're out of your element, Donny. Translation: that's not at all what he's asking. EDIT: ninja'd by Tallgeese :ninja: Edited December 14, 2010 by HugePinball Link to comment Share on other sites More sharing options...
Recommended Posts