Announcement

Collapse
No announcement yet.

Updating sun height during gameplay

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Updating sun height during gameplay

    • Just as a test I created a class based off of the AActor.
    • I then made a copy of the BP_Sky_Dome (or whatever its called)
    • I replaced its parent blue print with my new SkyDom class which was based off of AActor (as stated above)
    • I created a new public variable called SunHeight and made it editable

      Code:
      UCLASS()
      class ****_API ASkyDome : public AActor
      {
      	GENERATED_UCLASS_BODY()
      
      	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Lighting)
      	float SunHeight;	
      
      	void Tick(float DeltaTime) override;
      
      private:
      	float SunRiseSpeed;
      };
    • I placed the Tick event in and set PrimaryActorTick.bCanEverTick = true; in the construct method.
    • I replaced all original sun height references in the blue print nodes to my new available class property. Yes, all of them.
    • On tick I increase the sun height counter hoping for a sun rise... nothing happens, but the sun height does increment...

    What am I missing from this? I see that the BP_Sky_Dome blueprint only simulates once on launch of game, how do I make it update on my tick? It is running over my tick code... that's for sure!


    Code:
    void ASkyDome::Tick(float DeltaTime)
    {
    	Super::Tick(DeltaTime);
    
    	SunHeight += SunRiseSpeed;
    }
    Last edited by jimmyt1988; 08-10-2014, 04:41 PM.

    #2
    Ah, I see, I have to assign a portion of the pre-made graph to the tick event.. Is there a C++ version of the BP_Sky_Dome... I hate working with the graphs, they're so confusingly spidery.

    Comment

    Working...
    X