playMaker

Author Topic: objects don't spawn in correct position after dragging them out of an area.  (Read 1442 times)

NGKrush

  • Playmaker Newbie
  • *
  • Posts: 10
This might be a bit of a beginner question, but I'm stuck on this for a while now and I have no idea why it is happening. I have a hunch because it is updating too slow, but I wouldn't know how to fix it.

I'm making a scene where you can drag a number of objects left and right at the same time. When they reach the edge of a certain area, they move to the opposite side of this area.
 
The problem I am having is with the items reappearing at the new position. They seem to do so fine when I drag slow, but when I start dragging fast, items start to spawn on top of each other and all end up on the same position if I just shake my mouse left and right for a few times.

The scene setup is an empty object which I drag left and right, this item has 6 items (as children of the first empty object) which, when reaching a certain world position, will change.

I am currently running a dragging FSM which moves the empty parent object.
(On touch, I am comparing the difference between the start and current position and applying that to the items position to drag it left or right. This seems to be working fine.)

Then in each of the children I am running seperate FSMs (so 6 in total), I am getting their position and checking to see if it is under or over a certain value and if it is, setting their position to the other side.
This works as such:

state 1:
Float Compare -> if X < 10 goto state 2
Float Compare - > if X > -10 goto state 3

state 2/3:
Set Position
Next Frame Event -> goto state 1 (this next frame event is here because I keep getting too many loops if I don't use this)

Thanks in advance for looking at this problem with me. If you need any more details, I can post them up. Just let me know.

saneinsylum

  • Playmaker Newbie
  • *
  • Posts: 14
The float compare could possibly be lagging when the mouse is moving fast. Maybe try a cube with a trigger on each end of the screen and wait for collision to send the set position event? speed might still be a problem depending on how fast you're letting the mouse move, but its worth a shot.
And ill have to look into this next frame thing, I've just always used wait 0.01 when I have a 1000 loop.

NGKrush

  • Playmaker Newbie
  • *
  • Posts: 10
I think there is a lag there yes. After trying your idea I get the same results though. The same kind of results.

I was using a 0.01sec wait before, but also had the same results. I moved to this as I was thinking maybe the wait was the issue.

Thanks for your suggestion!

Is there another work around against the "lag" of the compare? If that is the actual problem.

saneinsylum

  • Playmaker Newbie
  • *
  • Posts: 14
its probably based on the same problem where bullets fly through enemies without triggering a collision. the collision is measured at one point in a clock cycle. if the bullet goes in and out in between checks, it wont register. can you limit the speed of the objects being dragged?