Jump to content
  • 0

Anyone give me example of using Actor in CPP


3 answers to this question

Recommended Posts

  • 2

The BaseActor class i use to derive actors from.
Use it just like you would use a entity script.

Attach actor to a entity.

baseActor = new BaseActor();


#include "Leadwerks.h"

using namespace Leadwerks;

const enum class ActorType : char { Base, Player, NPC};

class BaseActor : public Actor
	//Built-in extendable functions
	//virtual void EndAnimation(const int sequence);
	virtual void Sleep();
	//virtual void Wake();
	virtual void Attach();
	//virtual void Detach();
	//virtual void Collision(Entity* entity, const Vec3& position, const Vec3& normal, float speed);
	virtual void UpdateWorld();
	virtual void UpdatePhysics();
	//virtual void UpdateMatrix();
	virtual void PostRender(Context* context);
	//virtual void Draw();
	//virtual void DrawEach(Camera* camera);
	//virtual void ReceiveSignal(const std::string& inputname, Entity* sender);
	ActorType actorType = ActorType::Base;

	virtual ~BaseActor();



#include "BaseActor.h"



void BaseActor::Attach()
	//System::Print("BaseActor Attached.");

void BaseActor::Sleep()
	//System::Print("BaseActor Sleep.");

void BaseActor::UpdateWorld()
	//System::Print("BaseActor UpdateWorld.");

void BaseActor::UpdatePhysics()
	//System::Print("BaseActor UpdatePhysics.");

void BaseActor::PostRender(Context* context)


  • Thanks 1
Link to post
  • 0
1 hour ago, reepblue said:

I can give you one when I get home. What's the issue you are having?

I return to leadwerks cpp learning process and I did not find any example file like in tutorial, so that I can't learn from it


This should be fixed. or the example code should be put into this tutorial page, maybe Josh is too busy to fix this


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...