playMaker

Author Topic: pooled objects and add force  (Read 3005 times)

Deepee

  • Playmaker Newbie
  • *
  • Posts: 4
pooled objects and add force
« on: July 24, 2014, 06:47:48 PM »
Hello, i have an issue when using an object pooling system , for projectiles , which are spawned from a certain point . the first time they are spawned and
released through a mouse event or swipe event , they behave correctly and run
through the projectile FSM fine , but then when they are called up again and the FSM
has previously gone through a cycle , the projectile no longer works as it should with
the add force that is intended , i have tried setting force and velocity change with the same results , is there a way to reset the FSM loop so appears like it hasn't been activated ?
so every time it's called upon it's in a 0 loop on all states ?

thanks

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: pooled objects and add force
« Reply #1 on: July 24, 2014, 07:09:08 PM »
Seems like what you're trying to create is simple enough, but I can't figure out what is going wrong. Could you maybe upload a screenshot of the FSM?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: pooled objects and add force
« Reply #2 on: July 24, 2014, 07:24:35 PM »
I came across this when messing with PoolManager. I think its necessary to do some manual cleanup before despawning for sure.

It doesn't reset the velocity on physics based objects. I tried resetting them manually in brief, but it wasn't working and I moved on to other things.

Someone else asked this on the poolmanager forums with no solution to the issue eventually being posted, maybe if you're using PoolManager you could bump the thread over there? Seems like it would be something simple to fix, as not using physics because of the pooling system would be ridiculous.
« Last Edit: July 24, 2014, 07:26:12 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Deepee

  • Playmaker Newbie
  • *
  • Posts: 4
Re: pooled objects and add force
« Reply #3 on: July 24, 2014, 08:19:42 PM »
Thanks for the reply's ,
i will up load a screen shot soon.
and it is with Core game kit pool boss , i am trying to clean up its add force settings
by having add force set to zero when the projectiles are re activated.
do we think it could be something to do with rigid body component itself, can that be reset ?

Lostcity

  • Playmaker Newbie
  • *
  • Posts: 31
Re: pooled objects and add force
« Reply #4 on: July 25, 2014, 12:53:53 AM »
Your not alone on this one. I had the same issue with my FPS game shooting bullets. The first bullet (or how ever many I set to pre-load) would work exactly as expected. However, the recycled bullets would shoot off in random directions with varying speed.

I struggled with the issue for a while and ended up just moving on. Luckily the pool manager did work with my enemies and pick-up objects which helped a lot with performance. I needed to finish the game, so i just set the bullets back to their original create and destroy actions. Sense the bullets were the only thing in the game using create and destroy, there wasn't much garbage data and the performance hit wan't bad at all. However, I still wish I could set the bullets to pool.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: pooled objects and add force
« Reply #5 on: November 02, 2014, 04:02:59 AM »
Did anyone ever find a solution to this? I'm having the exact same problem with the despawned/spawned bullets using SmartPool.
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: pooled objects and add force
« Reply #6 on: November 02, 2014, 09:31:42 AM »
I didn't solve it with pool manager but I did it on a custom Pooler. I ended up setting Is Kinematic on and off, resetting both Velocity and angularVelocity then doing next frame event after it's is respawned before doing any new forces.

Seemed to work for me. Didn't test thoroughly outside this custom pooler.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: pooled objects and add force
« Reply #7 on: November 02, 2014, 04:29:13 PM »
Thank you Lane! I'll give this a try-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!