The method you used is pretty simple and straight forward:
change a property value via mouse input
play an action pose according to the property value
You can even remove the “cont.activate” and activate the action actuator with a simple AND controller. I suggested to move it into the if-block as you do not need to activate the controller when the mouse was not moved. The code itself does not need the actuator.
An alternative implementation would be to play the action pose via Python. It is not “better”. It is just a different implementation.
your script is good but when you keep move the mouse the property values keep go behind max animation value.
how to make the property values stop in the max values of the animation? if the animation end in 80 the property value should end in 80.
thank you for your help
im trying to make this script better to use for aim offset animation.
the script right now work great, the property values stop in max value of animation but it’s hard to aim to target.
i want to make it aim more smoothly.
then you are going about this wrong. what you want is a graphical representation of what the computer is doing.
[see edit]
now you can use a basic mouselook actuator on the camera to get your rotation limits, and have the animation just follow along. raycast from the center of the head straight forward, this will give the point the character is looking at. now, raycast from the barrel of your gun to that eye sight point we found when the gun shoots to see if a target was hit. the gun can be pointed at the eye sight point too.
slow projectiles can be added at the barrel and the forward axis aligned to the eye sight point. then the logic on the ammo can take over, homing, bouncing, etc.
demo blend coming soon, unless someone beats me to it.
EDIT:
just realized dots are circular, way better to just grab the euler rotation directly. DUH…:spin: