How can I apply applyOffsetForce() to aim a barrel?
I want to aim the up() of the barrel at my aim with applyOffsetForce()
How can I apply applyOffsetForce() to aim a barrel?
I want to aim the up() of the barrel at my aim with applyOffsetForce()
Last edited by Magos Mechanicus; 02-08-2010 at 02:33 AM. Reason: Merging doublepost
I'd suggest trying the applyTorque method. It's great for when you have a direction vector you want to aim in some direction.
I can wire anything directly into anything! I'm the Professor!
-Professor Hubert Farnsworth
I don't think that will work.
applyOffsetTorque would have been handy for something like this.
Can you help me understand how to use it?
Yes it will.
Code:Mul1 = 1000 Mul2 = 20 TargetAngle = (owner():aimPos() - E:pos()):toAngle() + ang(90,0,0) #<- notice +ang 90 will make it aim with the UP dir. (Edit: or maybe - ang 90) Torque = E:toLocal(rotationVector(quat(TargetAngle) / quat(E))+E:pos()) E:applyTorque((Torque*Mul1-E:angVelVector()*Mul2)*E:inertia())
PewPew (New GCombat): http://www.wiremod.com/forum/wiremod...w-gcombat.html
SVN TUTORIAL: http://www.facepunch.com/showthread.php?t=688324
E2 THREAD: http://www.wiremod.com/forum/custom-...ns-thread.html
MY SVN LINK:Code:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Haha, I understood till the 4th line. Mind explaining what quat() and some others do?
I would solve it with setAng(), as this will be more acurrate and wont fail at all.
I personally don't like to do aiming with force, as it's not 100% acurrate![]()
Go look at the applyTorque tutorial. I only posted that messy code because I assumed you had already read the tutorial so that you would understand it (at least somewhat understand it...).
Orly. (Tip: fullscreen)
Extremely fucking accurate turret - Xfire Video
Edit: Oops double post.
Last edited by Magos Mechanicus; 02-08-2010 at 07:03 AM. Reason: Oops indeed.
PewPew (New GCombat): http://www.wiremod.com/forum/wiremod...w-gcombat.html
SVN TUTORIAL: http://www.facepunch.com/showthread.php?t=688324
E2 THREAD: http://www.wiremod.com/forum/custom-...ns-thread.html
MY SVN LINK:Code:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Bookmarks