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"

Actor as box. How to set material?

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "Platform.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class LUDUMDARE30_API APlatform : public AActor
 {
     GENERATED_UCLASS_BODY()
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
     bool bIsActive;
 
     UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
     TSubobjectPtr<UBoxComponent> BaseCollisionComponent;
 
     UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
     TSubobjectPtr<UBoxComponent> PlatformBox;
     
 };

 
 
 #include "LudumDare30.h"
 #include "Platform.h"
 
 
 APlatform::APlatform(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
     bIsActive = true;
 
     BaseCollisionComponent = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("BaseBoxComponent"));
 
     RootComponent = BaseCollisionComponent;
 
     PlatformBox = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("PlatformBox"));
 
     //PlatformBox->SetSimulatePhysics(true);
     //PlatformBox->
 
     PlatformBox->AttachTo(RootComponent);
 }
 
 

Hi.

I wanted to make an Actor represented as box but how should apply material to him?

Thanks in advance for help.

Product Version: Not Selected
Tags:
more ▼

asked Aug 24 '14 at 09:55 PM in C++ Programming

avatar image

Harsay
33 3 5 9

avatar image Duncan Dam Aug 25 '14 at 01:43 AM

From what i know, box component don't have any actual mesh to set material, is just used for collision detection.

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

1 answer: sort voted first

This is how you add 1 material.

 //Adding materials to the static mesh component.
     static ConstructorHelpers::FObjectFinder<UMaterial> Material(TEXT("<INSERT MATERIAL REFERENCE>"));
     if (Material.Succeeded()){
         this->StaticMeshComponent->SetMaterial(0, Material.Object);
     }

UBoxComponent cannot have materials added to it.

more ▼

answered Mar 22 '15 at 02:20 AM

avatar image

asperatology
293 31 30 91

(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