I was working on a project and noticed that when collided something on edge, angular velocity of a physics object wouldn’t stay at (0,0,0), even though I set Max Angular Velocity to 0 both in the project settings and a static mesh component of the object.
Here’s how to reproduce the issue.
Create a blank project
Create Actor class buleprint
Open the created actor and add sphere mesh
Make the mesh the new root
Set Simulate Physics to true on the mesh
Set Enable Gravity to false on the mesh
Set Max Angular Velocity to 0
Open the Project Settings and from the Physic tab, set Max Angular Velocity to 0
Call “Get Physics Angular Velocity” and create link to the Event Tick.
Get reference of the mesh in the Event Graph and plug it into the target pin of the “Get Physics Angular Velocity”
Call “Print String” and plug return value of the “Get Physics Angular Velocity” into the “In String” pin.
Link “Get Physics Angular Velocity” with “Print String”
Call “Delay” node on “BeginPlay” and set duration to 1
Call “Add Impulse” and connect it to the delay node.
Call “Get Actor Forward Vector” and multiply the return value by 100, then plug the calculated value to the “Impulse” input pin of the “Add Impulse” node.
Place the actor on a level
Place a cube along X axis of the actor and move it along Y axis to make sure the actor hits the cube on edge
Hit play and check the printed value
You’ll be able to see the printed value changes for a brief moment.
And one more thing; even if this turns out to be an actual bug, obviously the staff would need some time to fix it. The problem is, I’m kinda behind schedule.
So I was wondering if there is any other way to have a physics object ignore its angular velocity when hitting something so the velocity of the actor wouldn’t be affected by the angular velocity?
In this situation the physics here is working as intended so this is not a bug.
For what you are trying to do using physics is not the best option. Using transforms with the sweep value checked would be much better. You can use ActorLocalTransform and ActorWorldTransform while using a lerp to go from one point to another over a set period. Just be sure to be using sweep with these.
I’ll try my best to clarify here. The way you were using physics in your Blueprint was setting the initial angular velocity. Once the object starts to move that angular velocity changes otherwise the object would never move. Your Blueprint would need a lot more logic in order to make it not move when it collides with something. At that point it is easier to just use the transforms I listed above rather than physics. With the current logic in the Blueprints provided the physics aspect of this is working properly. I hope this helps.
There’s a lot more going on in the project so I need to simulate physics. Updating location manually is not the option here. And honestly I still don’t get it. When I saw “Set Max Angular Velocity” I assumed this would determine the limit for angular velocity of an object rather than the initial value. If my interpretation is incorrect, then what’s the point of having “Max Angular Velocity”? Also, I don’t think I understand what you meant by “otherwise the object would never move”. From what I’ve experienced so far, a physics object starting to move in a certain direction didn’t really affect angular velocity and vice versa if there’s no friction. Even in the project file I uploaded there’s no change in angular velocity when it gets an impulse. It stays at (0,0,0).
I just did another test. If I add impulse to an object on a location other than the center of mass of the object, it begins to spin. But if I do the same thing with max angular velocity set to 0, it doesn’t spin. So clearly that Set Max Angular Velocity node does something more than merely setting the initial value.
I do not know if this is a bug or not, but surely the answer doesn’t fully explain what’s happening. And sir, all due respect, I personally think you got some nerves to mark this as resolved yourself even after I presented another thing to look into. If anyone sees this, I can tell you, without any doubt, that what happened in my case is not supposed to happen and this problem is NOT resolved yet.
This is not a bug as this is how angular velocity works. Angular velocity is when an object is traveling along a circular path the central angle to the objects position is changing. So forcing an angular velocity to 0 will prevent any rotation on that object. This is whey when you start adding some values to the angular velocity or changing the center of mass that object begins to spin.
Without full context of what your are trying to do and why it is sometimes difficult to provide the best answers. Meaning that I would not have recommended something had I known prior that manually updating the location was not an option.
I apologize for the inconvenience and highly recommend asking your question in a separate section. Doing so will get your question the right people looking at it and thus lead to you getting the best help for what your doing.
If you want to find a way to do what you are doing using physics you will have to ask another question outside of the bug reports. Asking in the Using UE4 or the Blueprint scripting section would be more appropriate.