Announcement

Collapse
No announcement yet.

Keeping a child object from rotating with a parented physics object?

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

    Keeping a child object from rotating with a parented physics object?

    Basically, I have a character whose movements I want to be like the spheres in the "Rolling ball template" in UE 4.10+.

    However, I want to use a custom model (not a ball) and my custom model should NOT rotate with the collision sphere, only follow it. Is that possible without some inefficient trick like forcing its rotation every tick/frame?.. that just seems so messy.

    Here's an example of what I mean Imagine I only want the box to slide and follow the sphere without rotating itself.

    How would I do that?

    I tried "Lock rotation" constraints under physics for the box, but it still rotates with the collision sphere.


    To explain what I want a bit better: I want the box to seem to slide with the same physics as the spheres do, but I don't want it to tumble like a sphere, just slide on one side.

    And I'd like to use as few ticks as I possibly can.

    #2
    Quick and dirty method: dont make the box a child, grab the root components location anr set the box's world rotation to default and location to the root every tick.
    Need another dev on your UE4 project? Send me a shoutout and I'll lend a hand

    Comment


      #3
      Hm, interesting.

      I was hoping there was a solution without using ticks, but there doesn't seem to be.

      At least no simple ones..

      How expensive would it be to rotate an actor every frame? Isn't that rather dirty/messy/inefficient?

      Comment


        #4
        Yeah, quick and dirty indeed.

        But using tick events is literally the only way of doing anything tied to a constant update of an objects transform.

        Performance wise, its only 3-5 extra processes per tick, with no complex number crunching. So unless you spawn like 5000 of these suckers, most modern machines should handle it no problemo.

        If you DO intend to spawn obscene numbers of these things (or hook up the tick event to a complex task), performance savings can be had by making the rotation update only every few ticks, and having internal logic to process a certain subset of the spawned actors staggered across those ticks to distribute the processing.
        Need another dev on your UE4 project? Send me a shoutout and I'll lend a hand

        Comment

        Working...
        X