How? Set Yaw, Roll, with no other effects!

I need to force the yaw and roll of my projectile, but I want to keep it spinning! If I used a Vector, it works… but it reports UserData errors. If I use an Angle, it brings the spinning to a hault.

So, if you actually read that… here is the Question: How can I force the CURRENT YAW and the CURRENT ROLL to specific values, without affecting the angular velocity in pitch?

I’ve tried and tried, but after writing this, I had an idea… but when I tried it, not only did it fail to work, but it also stopped the projectile in mid air (for a reason I do not understand)

[editline]20th October 2013[/editline]

Well for that matter, I suppose I don’t care about Yaw or Yaw velocity… I only care about Roll, I want the projectile to stay straight!

local ang = self:GetAngles()
ang.p = mypitch
ang.y = myyaw
self:SetAngles(ang)

No, I tried that… it froze the model, or it kept it from spinning.

It starts out spinning at 720 deg/sec, then it bounces and starts spinning another way… I want to preserve the PITCH Rotation Velocity, and REMOVE everything else (maintain velocity, maintain the pitch/yaw + pitch/yaw rotation, and clear the Roll Rotation and present Angles.)

[editline]20th October 2013[/editline]

It uses vPhysics. Think of it like I was throwing a wrench, and I wanted it to always be vertical… (comparable to the throwing knife in COD MW, or the tomohawk in Black Ops)
[I haven’t tried changing the model WHILE it was flying, but it should work the same… physics changes are called using the entity model index, and as soon as the model is changed]

vPhysics, but since gravity scaling doesn’t work the way I did it… custom gravity simulation, different on every model, the physics + damage + visual model all can be changed while still using the exact same entity name (which works) using a ProductID variable.

Basically: I hate rolling!

[editline]20th October 2013[/editline]


If you could be so kind, if you wish to help me, please read the opening post carefully

(I’m not forcing you)

You know it’s really hard to come up with a solution without knowing what exactly you want to do and what you got at the moment, meaning code.

well, see, that is a problem… I don’t want to share my code anymore, at least not yet, but I could give some further explanation.

The physicsupdate function is used for controlling gravity, the water speed drop, making it drop after so many bounces, and slowing down angular velocity in order to prevent glitches.

Think is used for only one thing… since physics update might not be getting called, if the velocity is too slow, we “die” so to speak… in the future, things may happen like dropping a resupply pickup, blowing up, etc. This is so little SERVER code, it should be no problem at all.

physicscollide is used for bouncing the projectile using a mixture of its current velocity, and a velocity calculated from the hit normal (currently it ‘kills’ itself after bouncing 8 times)

If I try to control the angles, it is with one of those functions… not currently included, though.

I found a way to make it work, but it causes userdata errors.

[editline]20th October 2013[/editline]

That way that worked used a Vector() instead of an Angle()

[editline]20th October 2013[/editline]

It reported the userdata errors that way, maybe because I was doing entity:SetAngles( Vector )
In the game, that way visually worked perfectly

In other words…
[lua]entity:SetAngles( Vector( CurrPitch, CurrYaw, 0 ) )[/lua]

We would have to see what you’re doing to determine what you’re doing wrong.

I read this and instantly got what he was saying. He wants to set the angles of a object without modifying the object’s angular velocity
[lua]

local oldAngles = ent:GetLocalAngularVelocity();
ent:SetAngles( Angle( 0, 0, 0 ) );
ent:SetLocalAngularVelocity( oldAngles );

[/lua]

Thank you!!! This man gets it! That should work perfectly! (or at least be the key to this equation)
Thank you

[editline]20th October 2013[/editline]

It looks a good bit nicer, the physics are a LITTLE better, except it glitches at the end of its life, spinning in mid air without moving… even if I prevent the spinning, it won’t move.

[editline]20th October 2013[/editline]

I have decided, that well… since I use this entity for several different models, I tested the others out… it doesn’t look good for most of them, so I cut it out… thank you