So I have a basic shooting mechanic for an angry birds type game but I am having problems with figuring out how to determine the force by how far back the mouse is dragged. Any and all help would be appreciated. Below is a picture of what I have so far.
Thanks in advance!
Presuming that your just simply trying to convert that vector (initial location - current location) into the force of the shot, just get rid of the normalize node. It’s reducing the length of that resulting vector to 1.0f. You want the length of that vector to matter.
Then just continue to do what you’re doing (multiple the result by a float to scale it by a sensible amount.
Cool! That works perfectly! Is there a way to set the maximum vector of the mouse pull back so the player cant get crazy amounts of values?
You can use the ‘ClampVectorSize’ for that.
The clamp doesnt seem to be working.
I doubt it’s the clamp that’s not working (and I doubled checked here too), something else must be going wrong.
If you print out the results of the clamp, what sort of values to do you get? What are you hoping to see? Have you tried reducing the maximum size?
It looks like it prints the y and z values but it still isn’t applying the force to it. It’s weird though because when i set the min to 0 and the max to 9000000000000 or some crazy number it will apply force.
I’m not really sure what to suggest at this point - If it’s working without the clamping, but not without, are you sure the size of the vector isn’t just really small, or in the wrong direction or something? You could try working out what sort of value gives you the result you want (plug the numbers in yourself, straight into ‘Force’) and then compare them to the results you’re getting and see what’s going wrong.