Jump to content

Leadwerks newbie, duplicated entities, user error, C++. Solution?


sjg
 Share

Recommended Posts

Hey there,

 

I recently got Leadwerks and I've been trying to nut it out by, well, doing things. Currently having a whale of a time, but as I'm unfamiliar with it, I'm having a problem.

 

The situation is I have a class which I have created and when I instantiate it, it seems to create two instances of it at once.

 

I won't bore you with the actual code, but my process is:

 

1. Class "Player" has (a) a pivot entity, (b) a Model::Box, and © a physics shape. (a) is parent of (b), (b) has © as its shape. Physics attributes are applied to the pivot entity.

2. Class "MainState" contains a "Player*", which comes into being via a static Player::create() method which, naturally, returns a "Player*"

3. After being called, the object is visible in the world, but when I call SetInput (or even AddForce) on the Pivot entity of my Player, two objects are visible. Both fly off in opposing directions when force is applied.

 

Aside from me not really understanding how to correctly structure such a class in the Leadwerks ecosystem, I'm a bit baffled as to why this is happening. All I know is I'm creating two similar objects in the same physical space and when I move one, they bonk together and the other goes haywire too. The question is: why is it so? What should I do to my class in order to avoid that duplication?

 

Sorry if this turns out to be (ironically) a duplicate of another post, but I couldn't find anyone else anywhere having the same thing happen.

Link to comment
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.

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

 Share

×
×
  • Create New...