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"

Make camera smoothly follow rigid body?

Hey all! So I have a ship that I finally got to fly around pretty smoothly, now I need to be pointed in the right direction for camera controls. Could someone tell me where to look or give an example of how to create my own camera and set it up via C++ to follow my ship smoothly, and do a mouse orbit around it's target? Even just to give the camera a look at and follow target, I can figure out the smooth part. Any help is greatly appreciated, thanks in advanced!

Product Version: Not Selected
Tags:
more ▼

asked Apr 11 '14 at 07:18 PM in C++ Programming

avatar image

Clunk47
400 48 54 251

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

1 answer: sort voted first

Maybe I bit late, but for anyone, who will find this question... There is no definitive guide on setting up the camera in C++, I figured it out myself at some point. So, basically, you need to create a camera component and a "camera boom" component in your character (or actor). In the header file:

 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
 TSubobjectPtr<USpringArmComponent> CameraBoom;
 
 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
 TSubobjectPtr<UCameraComponent> FollowCamera;

And in constructor:

 // Constructing components
 FollowCamera = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("MainCamera"));
 CameraBoom = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
 
 // Setting up the attachements
 CameraBoom->AttachTo(GetRootComponent());
 FollowCamera->AttachTo(CameraBoom);
 CameraBoom->bUseControllerViewRotation = true; // This is how you will control the camera rotation
 

This setup is handy for any third-person game. You may control distance from camera to object by adjusting TargetArmLength on the CameraBoom component.

more ▼

answered Sep 07 '14 at 01:02 PM

avatar image

dragn
31 1 2 2

avatar image Clunk47 Mar 14 '15 at 11:17 AM

Thx man :)

(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