x

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"

How to make the camera follow my rag doll character?

I created my project using the "Code Side Scroller" template so that I have a blueprint character with a "CameraBoom" attached. The camera now looks at my character pawn capsule.

Now, I turn on ragdoll of my character with these 2 lines of code:

 Mesh->SetSimulatePhysics(true);
 Mesh->WakeAllRigidBodies();

Is there a way for me to, with code, make the camera look at the character mesh instead of the capsule? It looks like I can do it by calling CameraBoom's AttachTo function, but what should I use as the first parameter as it should be of type USceneComponent*? Thank you.

Product Version: Not Selected
Tags:
more ▼

asked Sep 10 '14 at 05:52 PM in C++ Programming

avatar image

kevterm
71 10 9 14

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

1 answer: sort voted first

When you ragdoll your character, the actor stays still and as you see the camera is following the actor not the mesh. Here's my solution, if you're character is dead, have the tick event update the actor to follow the ragdoll. Warping the actor like this will ignore physics collisions.

alt text

ragdoll_camera.png (66.2 kB)
more ▼

answered Jan 31 '15 at 05:35 PM

avatar image

Furroy
696 26 86 62

avatar image kevterm Feb 01 '15 at 08:21 AM

Furroy, thank you for your reply. I was actually looking for a way to do it in C++ code instead of Blueprint.

I found out how a while back and in case someone needs to know: Attach the cameraboom(USpringArmComponent*) to the scene component instead of root component by calling CameraBoom->AttachTo(GetMesh()) within the ACharacter class

Thanks again for Furroy's reply.

avatar image Furroy Feb 01 '15 at 12:45 PM

Oh well thanks for your response that would be a more efficient way of handling it. I'll try that in BPs later today.

(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