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"

[VehicleGame] How to change VehicleMovementComponent to custom one?

I wanted to add some updates to the custom Vehicle Movement component in the VehicleGame demo, that is in Pawns/VehicleMovementComponentBoosted4w.h/cpp

but I noticed the buggy pawn does not seem to use that component at all, instead utilizing VehicleMovementComponent4w

How can I set it up to actually use VehicleMovementComponentBoosted4w instead - or any other custom movement component derived from the default one?

Product Version: UE 4.12
Tags:
more ▼

asked Jun 23 '16 at 04:16 PM in C++ Programming

avatar image

Cpt.Trips
107 2 10 20

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

1 answer: sort voted first
 // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
 
 #include "Pawns/VehicleMovementComponentBoosted4w.h"
 
 ABuggyPawn::ABuggyPawn(const class FObjectInitializer& PCIP) :
 Super(PCIP.SetDefaultSubobjectClass<UVehicleMovementComponentBoosted4w>(AWheeledVehicle::VehicleMovementComponentName))
 {
 }
more ▼

answered Jun 23 '16 at 04:43 PM

avatar image

Gelani
73 3 6 13

avatar image Cpt.Trips Jun 24 '16 at 01:55 AM

Thank you, that worked just fine. Although one issue I'm having is this: in the vehicle Blueprint the component displays the proper parent ("VehicleMovementComponentBoosted4w"), but when I try to access properties added in the "boosted4W" class, I have to cast the VehicleMovementComponent to VehicleMovementComponentBoosted4w.

Here is my class declaration:

 UCLASS()
 class UVehicleMovementComponentBoosted4w : public UWheeledVehicleMovementComponent4W
 {
     GENERATED_UCLASS_BODY()
 
     UFUNCTION(BlueprintCallable, Category = "Game|Vehicle")
     void Test1();
 
 public:
     UFUNCTION(BlueprintCallable, Category = "Game|Vehicle")
     void Test2();
 };

Both, test1 and test2 are only accessible after casting as seen in the screenshot below. Is that to be expected or do I need to change code declaration?

casting

4w.png (502.4 kB)
4w.png (502.4 kB)
avatar image Gelani Jun 24 '16 at 11:10 AM

It is not issue. I must cast the VehicleMovementComponent to VehicleMovementComponentBoosted4w.

(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