I'd suggest trying the applyTorque method. It's great for when you have a direction vector you want to aim in some direction.
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 03:33 AM. Reason: Merging doublepost
Have you checked HERE first?
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.
Have you checked HERE first?
applyOffsetTorque would have been handy for something like this.
Can you help me understand how to use it?
Have you checked HERE first?
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())
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Haha, I understood till the 4th line. Mind explaining what quat() and some others do?
Have you checked HERE first?
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 08:03 AM. Reason: Oops indeed.
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Bookmarks