Announcement

Collapse
No announcement yet.

AddTorque and GetActorLocation weirdness

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    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.

    Leave a comment:


  • replied
    The 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:


  • replied
    So 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:


  • replied
    Can't figure it out. I've tried different settings but the only way I can have collision is to enable physics on child, which detaches it from root during simulation, with physics disabled I don't get any collision. Attaching my current setup:Click image for larger version

Name:	COM_and_plane_body.png
Views:	1
Size:	89.8 KB
ID:	1056849

    Leave a comment:


  • replied
    Thank 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:


  • replied
    Yes.

    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:


  • replied
    Do you mean that you have collision enabled only on mesh and physics only on sphere?

    Leave a comment:


  • replied
    Yes 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:


  • replied
    So, 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:


  • replied
    It 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:


  • replied
    First 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:


  • replied
    So does the rest of your mesh actually works with proper collision and etc?

    Leave a comment:


  • replied
    Yes 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:


  • replied
    I don't know if I should file it as a bug or request for new feature Being able to get or set center of mass is something very obvious for any physics based gameplay.

    Leave a comment:


  • replied
    That's interesting. I will try it with a sphere and see what the results are. Thank you.

    You are correct. With sphere the location does not move while rotating with AddTorque.
    Last edited by Kumppi; 09-15-2014, 07:54 AM.

    Leave a comment:

Working...
X