Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Lock mesh pivot to Camera

Hello! I'm trying to pick up an object with a button press. This happens just fine. However, I can't seem to get the object to turn with me. It turns with the camera, but the objects local rotation doesn't turn with the camera. Is there a way to bind the pivot of the object to the camera's direction as long as the object is being held?

I've been struggling with this and trying to figure out if there is a way to unlock the 'locked' rotation setting while holding it, but to no avail!


Product Version: UE 4.19
more ▼

asked Sep 18 '18 at 11:10 PM in Blueprint Scripting

avatar image

11 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I believe that you're trying the wrong thing mate. This question can be understood in two different ways; I'll explain both of them.

If you're trying to Rotate the Object when you're holding it, in your Programming, disable Add Pitch/Yaw when Holding it and add the Input turn Axis to the Local rotation of the object instead. If you're trying for the object to follow the character's general rotation, you can simply get ActorRotation.Yaw and then use that to set the rotation of the Yaw component of the object that you're holding.

more ▼

answered Sep 18 '18 at 11:30 PM

avatar image

251 15 14 20

avatar image 2Dios Sep 19 '18 at 05:09 PM

I'm not sure where to put the get ActorRotation node. I'm including an image of what I'm trying to accomplish. Thank you so much!alt text

alt text

example.jpg (240.1 kB)
avatar image IndieGameCove Sep 19 '18 at 06:02 PM

Get the cameras rotation on the start of grab and save to variable. Compare that against the rotation during the grab. The difference is the amount you need to rotate the grabbed object.

avatar image 2Dios Sep 19 '18 at 07:14 PM

I'm using the first-person camera from the template. When I run it, it says:

Blueprint Runtime Error: Accessed None trying to read property Camera from function: 'ExecuteUbergraph_FirstPersonCharacter' from node: SetActorRotation in graph: EventGraph in object: FirstPersonCharacter with description: Accessed None trying to read property Camera

I'm confused since I promoted the target of the first person blueprint to a variable.

alt text

avatar image IndieGameCove Sep 19 '18 at 11:46 PM

not sure what going on in your bp, but my first thought is that get actor rotation expects an actor as the target while your camera is not an actor but a component.

avatar image IndieGameCove Sep 20 '18 at 12:11 AM

if you add this code to your fp character you will be able to pick up the blue cubes from the vr template. the blue cubes can then be replaced with whatever static mesh you want. it won't be using simulating physic with this method though.

alt text

edit: you'll want to add the vr template to your project first so that you get the interface. you can do that via the big green 'add new' button then 'add feature or content pack'

grabobject.png (208.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Wouldn't it be easier to use the AttachTo node and just tell it to snap the rotation to the parent?

more ▼

answered Nov 28 '18 at 12:45 AM

avatar image

3.8k 18 20 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question