Might try that. Ori Cohen explained how GetCOM can be exposed in C++: https://answers.unrealengine.com/que...r-of-mass.html
Not sure, it's kind of weird that it's so hard or simply unclear how multi-body collision can be done for Actors.
Announcement
Collapse
No announcement yet.
AddTorque and GetActorLocation weirdness
Collapse
X
-
Kumppi repliedThe collision happens between a non physics object (fuselage) and a physics object (simple box) and I guess that in this case the non physics object just pushes aside all physics objects.
This is just an idea and I haven't tried it myself. It might fail miserably, but what if you enable physics on the fuselage on the point of impact or just prior to it while disabling the physics of the root object at the same time?
Leave a comment:
-
BoredEngineer repliedSo it's just doesn't work with landscape - just flies through it. But if I place a simple box with physics enabled, I can collide with it just fine. The only issue is that none of the force of collision is transferred back to my pawn - it's mass is 100kg and it pushes easily without stopping a box of 6647kg mass. Not sure what is going on here.
Leave a comment:
-
BoredEngineer replied -
BoredEngineer repliedThank you, Kumppi! I'll try that. It's much easier to balance forces now. I have an idea of how to triangulate a center of mass for cases when root can't be replaced with a dummy object, I'll post it in answers if it works.
Leave a comment:
-
Kumppi repliedYes.
To be more precise the sphere has collisions enabled. I just made it ignore everything. It didn't seem to work if I disabled collisions altogether.
Leave a comment:
-
BoredEngineer repliedDo you mean that you have collision enabled only on mesh and physics only on sphere?
Leave a comment:
-
Kumppi repliedYes I attached it as a child.
Getting the collision to work should be straightforward. All you have to do is make the sphere ignore everything and then configure the mesh to handle the collisions how ever you like. I'm not 100% sure what you mean by enabling the physics on mesh fuselage. In my case the only component that has physics enabled is the sphere mesh, which is also the root component. The spaceship mesh does not have physics enabled. It wouldn't work otherwise.
Leave a comment:
-
BoredEngineer repliedSo, I got everything moving - following the sphere but how I can get a collision now on a mesh instead of a sphere. As soon as I enable physics on mesh - fuselage it stops following sphere and just sits in air.Last edited by BoredEngineer; 09-16-2014, 04:35 PM.
Leave a comment:
-
BoredEngineer repliedIt does make sense, I've heard this suggestion before and should try it out. My problem is similar to yours, I just have airplane instead of spaceship.
Did you used bones to attach your mesh to the sphere? Reason why I didn't tried this yet is because my fuselage is a root static mesh right now and wings are separate components, as soon as I enable physics simulation on anything but fuselage, it get propelled to the moon and wings are staying behind.
EDIT: By attaching I guess you mean simple placing it as a child in components hierarchy?Last edited by BoredEngineer; 09-16-2014, 09:21 AM.
Leave a comment:
-
Kumppi repliedFirst forget my previous post about using the sphere component as a root. I wrote it before thinking which I do a lot.
Now I got my spaceship working nicely in that using AddTorque does not "wobble" the location returned by GetActorLocation. What I did was I just used another static mesh, a sphere, as a root and I attached my spaceship mesh to it. I call AddThrust and AddTorque on that root mesh and the spaceship mesh is just along for the ride. I then set the sphere mesh to be invisible and to ignore all collisions and overlaps. It seems to work OK.
I'm not sure if this helps on your particular problem. You talked about setting and getting the object's center of mass. In a way that is what I did. By moving the sphere mesh around I'm moving the center of mass of my spaceship mesh because the sphere mesh is the one which is affected by the physics forces and the spaceship mesh is attached to it. I hope I make sense. I'm not even sure myself
Leave a comment:
-
BoredEngineer repliedSo does the rest of your mesh actually works with proper collision and etc?
Leave a comment:
-
Kumppi repliedYes definitely. Creating a sphere or a cube volume around my spaceship solves the problem, but does wreck havoc with my collisions. At least if you could specify a bounding volume to be used exclusively with physics calculations would solve my problem at least
EDIT: OK I can solve my problem by using a USphereComponent as the root component. This bounding volume is centered on the pivot point of my mesh. I just set it to ignore everything and that's that.Last edited by Kumppi; 09-15-2014, 09:39 AM.
Leave a comment:
-
BoredEngineer repliedI don't know if I should file it as a bug or request for new featureBeing able to get or set center of mass is something very obvious for any physics based gameplay.
Leave a comment:
Leave a comment: