playMaker

Author Topic: 2d bullets, how do i get cloned objects to destroy themsleves on impact?[SOLVED]  (Read 2735 times)

jellyam

  • Playmaker Newbie
  • *
  • Posts: 19
I'm making a little side scrolling game with an enemy that shoots a bullet object at the player every couple of seconds, however i want the bullet clones to be removed once they hit anything in the scene. I did create an fsm that has a trigger 2d event that sends a destroy self action on the bullet prefab but it doesn't seem to be working. maybe its something with wrong with my spawner fsm which i've got on my enemy guy. I hope this made sense

i've attached a couple of pictures for reference

« Last Edit: August 26, 2014, 03:48:05 PM by Lane »

bizilux

  • Full Member
  • ***
  • Posts: 171
first of.... go into play, and when you see bullet spawning, hit pause. then click on that bullet, hit resume and check its movement FSM.

and pay attention if it will go from movement state into self destruct state.
im suspecting it wont, so here is ur problem, with colliders.
report back with ur problem, and how colliders are set up on bullets, and rigidbodies and on enemy too

most of times, its problems with colliders, they need rigidbody 2d on it most of times, or collision detection settings changed
« Last Edit: August 26, 2014, 03:00:35 PM by bizilux »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Probably spawning in a spot where the bullet collider is overlapping the enemy collider, so it instantly registers a collision.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jellyam

  • Playmaker Newbie
  • *
  • Posts: 19
after taking a closer look it was two things causing my problems, my bullets didn't have a rigid body attached to them and my enemy had a collider on him that would cause the bullets to disappear on impact when i would go to put a rigid body on the bullets. I changed those two things and bam, its working. This is good enough for me for right now but how would i shoot a slow moving bullet from under the player and have it not respond to gravity (which the rigid body inherently puts on objects)

and thanks for the quick response too   :)

bizilux

  • Full Member
  • ***
  • Posts: 171
rigidbody 2d settings on component.

either put gravity scale to 0, or tick is kinematic, and read more about it on unity docs