Maths

Why not take it for a spin yourself? Use the debug nodes to visualise what is happening - this will clarify things much faster than anyone could ever explain.

  • above, the tip of arrow indicates the root of this actor - that’s the actor’s world position, it’s not influenced by what the components are doing.

I’ve excluded the arrow component from the bounds calculations. The centre of the bounds - the Origin - will be smack-bang between the 2 spheres. It will be somewhere above the root. The spheres dictate the Extent while the cube does not contribute at all.

2 Likes

I can’t do such difficult things. I just started learning UE4. I’ll think about it a bit longer. And now I’m going to finish my AAA project. There is very little left, a couple of decades.

2 Likes

Ha. Story of my life!

2 Likes

I’m technically new to Unreal Engine, too, but coming with a background of computer programming, design, and technical experience that hasn’t much to do with Game Design but can be stitched together to accomplish the goal is what I’m at.

It can be daunting at times. This is why the community is here. :slight_smile:

Glad to have helped you generate more questions, and spark further research into additional engine features for you. It’s always good to see that. I actively encourage that! I’ve been learning quite a lot by just reading through threads, and keeping the API documentation on-hand.

1 Like

Another question of a minor plan. There are two objects in space. Parent object with coordinates
Parent_V (Xp, Yp, Zp)
and rotation
Parent_R (Rp, Pp, Yp)
and child object with coordinates
Child_V (Xc, Yc, Zc)
and rotation
Child_R (Rc, Pc, Yc)
I change the coordinates and rotation of the parent and watch the coordinates and rotation of the child change. In this case, everything works fine. The problem is that I first need to change the position of the child relative to the parent. And then I change the position of the parent, but the transformation of the child is not happening in this case. How can I solve this problem? How do I mathematically calculate the position and rotation of the child object? I need calculation formulas or some other solution.

You mean you’d like the child to orbit the parent when its rotation is adjusted?

Well, at least I’ve got math in me. Quaternions are scary.

I’m scary. Can relate. Alright, I’ll bite. But this did take the better of my morning. So no blueprint, just the math this time.

Convert Child_Transform and Child_Rotation to local world space:

Child_Local_Translation = Parent_Translation - Child_Translation
Child_Local_Rotation = Parent_Rotation - Child_Rotation

Rotate child locally in relation to the parent:

Rotates a cartesian vector using the FRotator quaternion with GLMs dot-dot-cross implementation.

Child_Local_Translation = 2.0f * dot(Child_Local_Rotation, Child_Local_Translation) * Child_Local_Rotation
      + (Child_Local_Rotation.W * Child_Local_Rotation.W - dot(Child_Local_Rotation, Child_Local_Rotation)) * Child_Local_Translation + 2.0f * Child_Local_Rotation.W * cross(Child_Local_Rotation, Child_Local_Translation)

Now convert those to world:

Child_Translation = Parent_Translation + Child_Local_Translation
Child_Rotation = Parent_Rotation + Child_Local_Rotation

When you run your game, this should cause your child to orbit its parent, by treating its world space coordinates appropriately relative to the parent and applying a computer-optimized Rodrigues rotation formula, regardless of any Unreal parent+child relationships made in the editor.

Suggestion: You could also extend this by using the GetBounds trick to rotate the child from the center of the parent, similar to the orbit feature you are describing. This concept will rotate from both pivots.

If you want to see this in the editor, you’ll need to configure your actors to be able to tick in the editor and override one of the editor events related to moving the actor in its class, which to my knowledge is a C++ only thing, unless I’m wrong.

1 Like

I did not understand anything and will ask the question differently. I have two cylinders. Parent (white) and child (green). I set the transformation of the child relative to the parent manually.


I need using two variables
Get relative transform
Get world transform
Return child to parent transform

The result should be like this

The result should be like this

Set all to 0.

Get relative transform
Get world transform
Return child to parent transform

But you already have them all in the pic…


For Local to World and vice versa, look into the (inverse) transform nodes:

Their tooltips are actually pretty handy.

1 Like

I have them, but I need other values. I need a parent world transform.

It won’t help me. I just gave an example. There is no parent or child in my game. I need to calculate the transformation of a virtual parent that does not exist, and these values are already set to zero.

Yeah, no. I’m not getting this.

It won’t help me. I just gave an example.

You got the precise answer to your question. Perhaps you need to ask differently. There is so much confusion in this thread already.

There is no parent or child in my game.

All your examples and screenshots so far very clearly revolve around parent - child relationship. I hope you understand where our confusion comes from.

1 Like

The thing is, I don’t know English and I don’t understand how to use them at all. Plus I’m a complete newbie to UE4. If possible, give an example using these nodes.

Yes, I understand where the confusion came from. I’ll try to explain. In my game, there is a relative transformation between the real parent and the child. But I need to apply this transformation to an object that has no parent (he is an orphan) and find its virtual parent.

Sure thing! We’ve got 2 elements here with no relationship whatsoever: aActor (the white cube) and Floor2 (the grey slanted mesh); nothing is attached:

  • with no transformation of the direction from the gamepad, the aActor Cube moves in World Space, as expected:


  • below, after transformation, it is using the transform of the Floor2. Do note there’s no Z here but the aActor still goes up & down the slope.

1 Like

Using this as an example as it might allow you to move the cylinders/piston in the way you need. Hopefully!

1 Like

Thanks for the good example, but so far I haven’t succeeded.

Thanks, but basic concepts that I already know are discussed here. I am asking a specific question that requires a specific solution. I need to set the child to the parent’s position (as shown in the screenshot above). But the parent does not exist.

When there’s NO PARENT… Game developers will often add an invisible parent to the world anyway to help. A hidden mesh that can be used as a reference point to solve a problem.

This, it’s common to use a dummy. But if you do not want to (or cannot) use a dummy component to hold transform data, perhaps you can just pipe in raw data.

In this example:

Provide a vector and a rotator instead:

We don’t really know what you’re trying to accomplish - it’s so very enigmatic :alien:

Russian

Google translator

Translation is about 95% accurate

That’s right, I have already used this technique. But I’m still interested in how, knowing the coordinates of the child and knowing the relative transformation, calculate the position and rotation of the parent.

Based on this example, I tried to perform inverse transformation to the child to set it in place of the parent, but it did not work for me. So I am asking for help here.