Get the difference between the last and the current EulerAngles variable, add it to another variable, check that variable and if the variable is over 360, subtract 360 from it and add one to the spin counter.
So, something like this (might not work exactly as it's typed in, didn't test the code but it can at least be used as pseudo-code):
float rollDegree =...
To align a javelin, you should properly compute all forces.
The reason that a javelin can orient itself into its path, is because of air drag.
Note that the drag is not always asymmetric enough to induce enough torque to align it:
Sometimes a javelin lands with point sticking in the grass, sometimes it lands flat on the ground.
Note that gravity should ...
My recommendation is to compute a restorative torque to apply to the object. This is physically more accurate than setting the velocity directly, and the simulation will be better behaved.
This solution should also work for any launch angle. Below is a gif of this method at work stabilizing arrows launched from a car.
I wouldn't recommend planning to switch engines. You should always develop in the game engine you ultimately intend to use. The only possible exception is when prototyping, and that doesn't sound like what you're asking about.
That said, Hero Engine looks like a fine choice for the entire project. There is one obvious advantage to Unity: it's cross platform....
Have you ever thrown a javelin straight up? It does actually rotate quickly on top, because the pointy end is heavier. But it does so not when it reaches the top but after the velocity changes to move downward. It's built that way to ensure the pointy end hits the target ...
You can try to model torque but that gets ugly with different weights, lengths, and ...
Might be advantageous to not demand a totally full circle (= airplane back completely horizontal rotation) for an "accepted roll" - maybe it's sufficient, and more user-friendly, to reach an almost horizontal position in order to consider it a completed roll? In addition, it's always a bit hairy to use an accumulation over a long period of time - it may ...
ForceMode is an enumeration. It has 4 values,
ForceMode.Acceleration = Constant change not affected by mass
ForceMode.Force = Constant change which is affected by mass
ForceMode.Impulse = Instant change which is affected by mass
ForceMode.VelocityChange = Instant change which is not affected by mass
For more details, watch the Official Unity tutorial ...
The default rigidbody.AddForce applies the force facing the center of mass of your rigidbody, so it will never directly cause any rotation. But there is also the method rigidbody.AddForceAtPosition(Vector3 force, Vector3 position, ForceMode mode). This method can be used to apply forces to an object which are off-center and thus will result in a mix of ...
Torque is just a rotational version of the same principle as linear impulses:
Let us look at
F = ma
To compute the change in velocity, we change it to
a = F/m
Likewise we can say:
T = Iw
Where T is torque, I is inertia, and w is angular acceleration. Let's rearrange that:
w = T/I
Now we can use torque to compute the change in rotation.
maybe you should position the javelin in such a way, that the 'nose' of the javelin is where the curve is, not in the middle, that way it might look a little 'more natural'.
you can add a turning delta that javelin can turn only by certain degrees that are given to it, that way it goes maybe a little bit out of sync but it will look better ;-)
One suggestion I could think of is to restructure how you think of the math, and also working from the outside in.
So first, have it so that your input directly controls the wheels - not very realistic, but it will allow for you to see what happens with the physics of the wheels spinning against the ground without an excessive amount of variables ...
I will assume this question is about 3D SAT which I find has alot less resources than 2D..
I have been struggling with this for the past week. I have face contacts down but not Edge cases.
When you are testing your various axes keep track of which has the minimum overlap, that is your contact normal and penetration depth.
Contact points are where it gets ...
If you are trying to deduce difference in force and how it effects a single object with a change to its center of gravity, making each component of that object, a single object and then using its force to calculate any strain or pressure would seem to be the way to do it.
If you have two weights on a bar, and they rotate around the center, and then you want ...
It seems to me that you haven't defined enough of what is happening in your system, to know how it should move.
I.e., I think you are missing the forces involved when one of the two component objects rotates itself. In real inertial physics, nothing moves without force being applied, but it sounds like your model for the component rotation may not include ...