Announcement

Collapse
No announcement yet.

unity public gameObject equivalent

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

    unity public gameObject equivalent

    I've been slowly trying to make the switch from unity to unreal and brushing up on my C++ skills i haven't used in ages.

    The one simple thing i can work out is the equivalent to creating a public gameObject variable and dragging a object into it to set it. Is there something similar in unreal blueprint ?

    I'm trying to find 2 joints in my skinned character (eyeballs) so i can make them follow/look at another object. Can anyone suggest the easiest way to go about this?


    #2
    I don't use unity, but after a quick read-up i think the best fitting equivalent to gameObject would be AActor/Actor.

    The simplest object that can have a location and rotation in the level is an actor (in C++ called AActor, in Blueprint simply Actor). Ingame it has no visible parts but can be moved around and other actors (like characters) can get its location and do something with it (run to it, rotate towards it, etc).
    You can add components to an actor, such as StaticMeshComponent or SkeletalMeshComponent to add a visible mesh to this actor or other components that are not visible but do certain things (like collision hitboxes). These components can add additional functionality or attach visible objects to that actor.

    If i understand you correctly, you probably want to make a Blueprint that inherits from the Character class, then change its Skeletal mesh to whatever your skinned mesh is. Then you need to add a Actor reference in your Blueprint variables, which is then set as the actor your characters eyeball meshes are supposed to rotate towards (rotation would probably be done each frame, aka in the Tick() event/function of the character).
    Last edited by StefanHohnwald; 08-31-2018, 05:01 PM.

    Comment


      #3
      Thanks for the reply.

      I managed to find this tutorial that covers most of it, but I still can't work out how to get the eye bone in its blueprint. I've found such nodes as "Get Bone Location by Name", but I can't work out how to set it's Target?

      This is what I have so far, but I have the WARNING while trying to get the Target for "Get Bone Location by Name". Can anyone point me in the right direction?

      Click image for larger version

Name:	UpdateEyeRotation.jpg
Views:	120
Size:	173.8 KB
ID:	1522767

      Comment


        #4
        Unfortunately this is more complex than using one node. You have to assign or modify Animation Blueprint of your (probably character) or what ever you have. Animation blueprint handles every action where you want to modify bone transform of any kind and more. What you are looking for is a node in Anim Graph inside Animation Blueprint called "Transform (Modify) bone".

        I hope this will help and feel free to ask for more details if necessary.

        Comment


          #5
          Thanks for the reply.

          I have that part worked out and by using the "Transform (Modify) Bone" node I can change the direction of my eyes, but I still can't get the location of the eye bone ("J_Eye_LE") to calculate the correct rotation with "Find Look at Rotation".

          I have 2 variables set up in the Anim Graph, EyeLERotation and EyeRIRotation which connect to "Transform(Modify)Bone" nodes which work ok if I set the values.

          Click image for larger version

Name:	UpdateEyeRotation_Anim_BP.jpg
Views:	50
Size:	107.1 KB
ID:	1522813

          I then have a function called UpdateEyeRotation which is the one I'm having problems with because I can't calculate the new rotation. I have the object I want the eyes to look at stored in a variable, ("LookAtObject"), which I was able to set up in the "Event Blueprint Begin Play". This variable also drives a blendspace correctly so I know it's working fine.

          What I can't get working is the "Find Look at Rotation" node because I can't work out how to pass in the eye bone for the Start location (I just noticed I have the Start and Target the wrong way round in this screen shot).

          Click image for larger version

Name:	UpdateEyeRotation02.jpg
Views:	52
Size:	151.8 KB
ID:	1522814

          Comment


            #6
            It seems what I had was close, however, you can't do it in the characters blue print, it must be done in the animation blue print which was my main problem.

            Now I have eyes that follow a object, but, they are about 45 degrees off.

            This has now changed a lot from the original question and topic, so I'll start another thread if I can't work out why they don't aim exactly at the object.

            Comment

            Working...
            X