Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

Not sure if I'm using these right - is GetObjectA() the correct one to use?

auto _interaction = new Interaction();
entity->SetObject("interaction", (Object*)_interaction);
auto test = entity->GetObjectA("interaction");//retuns NULL

I've been using SetUserData() previously but I need more than one object assigned to an entity.

Link to post
Share on other sites
17 minutes ago, Lethal Raptor Games said:

I've been using SetUserData() previously but I need more than one object assigned to an entity.

Then you should be able to make the user data that you set a list of objects that you can add/remove from.

Link to post
Share on other sites

A script must be assigned for an entity to contain script properties. Quick test:

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
	Leadwerks::Window* window = Leadwerks::Window::Create();
	Context* context = Context::Create(window);
	World* world = World::Create();
	Camera* camera = Camera::Create();
	camera->SetRotation(35, 0, 0);
	camera->Move(0, 0, -6);
	Light* light = DirectionalLight::Create();
	light->SetRotation(35, 35, 0);

	//Create a model
	Model* model1 = Model::Box();
	model1->SetPosition(-1, 0, 0);
	model1->SetColor(0.0, 0.0, 1.0);

	//Create a copy
	Model* model2 = (Model*)model1->Copy();
	model2->SetPosition(1, 0, 0);
	model2->SetColor(0.0, 1.0, 0.0);

	//Lets modify some vertices to show the copy is unique
	Surface* surface = model2->GetSurface(0);
	surface->SetVertexPosition(0, -0.5, -2, -0.5);
	model2->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB);

	model1->SetObject("TEST", surface);
	auto a = model1->GetObject("TEST");
	Debug::Assert(a == surface);

	while (true)
		if (window->Closed() || window->KeyDown(Key::Escape)) return false;


  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   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...