playMaker

Author Topic: Problem with infinite spawning level [SOLVED]  (Read 1013 times)

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Problem with infinite spawning level [SOLVED]
« on: February 23, 2021, 09:46:09 AM »
Hi guys,
So im spawning a level piece, which, after being spawned, moves along the z axis.I store the objects Z position, then compare it to -100, the idea being, when my object Zpos hits -100,it is now equal in the float compare,so it fires off the actions to despawn,and spawns a new piece, and the whole cycle starts again.
At the moment, it mostly works, however, the float compare sometimes doesnt call the equal to event, possibly due to frame rate, so i use "greater than" also.
This works, but i end up with little gaps between level pieces now.
Very unsure of how to fix it.
Originally i was just using colliders, so when the level piece hit them, it would do the same, but i thought doing it this way would be less expensive on resources for mobile.
Is there any work around anyone knows? Is the float compare a bad idea?

Thankyou kindly.
Jason
« Last Edit: February 24, 2021, 08:22:01 AM by 3dambit »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Problem with infinite spawning level
« Reply #1 on: February 24, 2021, 05:45:13 AM »
Hi.
maybe you could do this :
If compare gets triggered (equal and/or greater) use a set position on the z and place to -100

ManInAShedGames

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Problem with infinite spawning level
« Reply #2 on: February 24, 2021, 08:20:28 AM »
Hi.
maybe you could do this :
If compare gets triggered (equal and/or greater) use a set position on the z and place to -100

Hey DJ, thanks. I eventually got it working.no matter what I did, if the frame rate dipped during play,the level would end up with gaps always, here's how I fixed it.

Instead of spawning at a set position,I attached an empty to my level piece, using that as the spawn location.
Now, even if a few frames are missed,the object will always spawn at the correct position, no gaps!
Thanks DJ.