# Pass property in collision without a script component / go.property

**URL:** <https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218>\
**Category:** Questions\
**Created:** [February 25, 2018, 11:00pm UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218 "2018-02-25T23:00:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tacklemcclean](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/tacklemcclean/32/7634_2.png) [@tacklemcclean](https://forum.defold.com/u/tacklemcclean)\
**Post date:** [February 25, 2018, 11:00pm UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/1 "2018-02-25T23:00:45Z")

</div>

In my game I have lots of bullets. Likely not reaching the total limit of script instances - yet - and I’m not sure how close I’ll get.

My player ship shoots bullets instantiated by a factory and moved with go.animate.  
It collides with enemy ship. Enemy ship handles collision message. Here, I want to deliver x amount of damage to the enemy ship, and **I’d like the bullet to carry the damage in its game object**.

**Is there any way to put this data in the game object _without_ a script component?**  
And then have the enemy ship read that damage amount off of the bullet at collision message parsing.

Factory instantiation lets me put properties on game object but that requires go.property set up as well.

---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [February 25, 2018, 11:50pm UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/2 "2018-02-25T23:50:56Z")

</div>

If you’re not using z you could use it to store a damage value. You could store a bunch of data in z with data packing. Then whatever is being hit could check the z of whatever has impacted it.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 26, 2018, 4:40am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/3 "2018-02-26T04:40:54Z")

</div>

We do not provide a way to do this. I’d probably store the additional data in a Lua table keyed on game object id.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [February 26, 2018, 8:46am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/4 "2018-02-26T08:46:56Z")

</div>

A variant on @britzl’s suggestion is to check the [other\_group](https://www.defold.com/ref/physics/#contact_point_response:position-normal-relative_velocity-distance-applied_impulse-life_time-mass-other_mass-other_id-other_position-other_group-own_group) to see what type of bullet it is. Again, it’s stored in a Lua file (or perhaps in the enemy script properties)

---

<div class="post-metadata">

**Author:** ![sicher](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sicher/32/8_2.png) [@sicher](https://forum.defold.com/u/sicher)\
**Post date:** [February 26, 2018, 8:55am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/5 "2018-02-26T08:55:25Z")

</div>

You can go one step further and check the fragment of the sender and identify specific bullets. 🙂

---

<div class="post-metadata">

**Author:** ![tacklemcclean](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/tacklemcclean/32/7634_2.png) [@tacklemcclean](https://forum.defold.com/u/tacklemcclean)\
**Post date:** [February 26, 2018, 9:06am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/6 "2018-02-26T09:06:21Z")

</div>

Wont the fragment always be empty if I’m not using a component? Using a simple bullet factory, they’d only be /instance45, /instance46 etc?  
Maybe I misunderstand your suggestion.

@Mathias_Westerdahl I thought about that too but don’t want to use too many groups (will hit limit, many weapon types!)

A simple table looks like a good solution right now.

---

<div class="post-metadata">

**Author:** ![sicher](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sicher/32/8_2.png) [@sicher](https://forum.defold.com/u/sicher)\
**Post date:** [February 26, 2018, 9:08am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/7 "2018-02-26T09:08:50Z")

</div>

As soon as you have a collision object component that will be the fragment.

But I misthought. Each instance will be uniquely identified by the path, not the fragment. If you have an object with several collision objects you can separate them via the fragment though (for instance if you have hit boxes on a character).

---

<div class="post-metadata">

**Author:** ![tacklemcclean](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/tacklemcclean/32/7634_2.png) [@tacklemcclean](https://forum.defold.com/u/tacklemcclean)\
**Post date:** [February 26, 2018, 9:32am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/8 "2018-02-26T09:32:17Z")

</div>

That’s awesome though, easy way to make bosses take more dmg if you hit them in the eye!

---

<div class="post-metadata">

**Author:** ![sicher](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sicher/32/8_2.png) [@sicher](https://forum.defold.com/u/sicher)\
**Post date:** [February 26, 2018, 9:42am UTC](https://forum.defold.com/t/pass-property-in-collision-without-a-script-component-go-property/17218/9 "2018-02-26T09:42:00Z")

</div>

Yes, exactly!
