Object Position Through Plugin

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Jun 13, 2009 10:10 pm

Okay, so I know how to do object positioning through a plugin, but I've kind of got a snag. Here's the relevant code from my IK plugin:

[code:7gn99nrj]// Correctly position the second bone
objBT->info.x = objBO->info.x + cos(objBO->info.angle / R) * (objBOW + RD);
objBT->info.y = objBO->info.y + sin(objBO->info.angle / R) * (objBOW + RD);[/code:7gn99nrj]
This positions the second bone to the end of the first. Everything seems to work fine for the most part. Yet it doesn't.

If, using events, I have the first bone constantly positioned to another object, once the bones move too far from their starting position, the second bone will just disappear. I can do a check on the coordinates for the second bone, but they're where they're supposed to be. The thing just vanishes. Is this a flaw in my coding, or a bug in Construct?
Moderator
B
98
S
36
G
19
Posts: 1,584
Reputation: 17,717

Post » Sat Jun 13, 2009 10:16 pm

If you want to update an object's position/size/angle via the SDK, you have to call:

pRuntime->UpdateBoundingBox(object);

After modifying a value.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sat Jun 13, 2009 11:00 pm

Awesome, that fixed it! Thanks. :)
Moderator
B
98
S
36
G
19
Posts: 1,584
Reputation: 17,717


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests