Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Meka Games on January 05, 2018, 10:43:35 AM

Title: Shooting with raycasts
Post by: Meka Games on January 05, 2018, 10:43:35 AM
Hello.

I wanto t mgun shoake a ts with ps hits and  I fo aty3d.com/learn/tutorials/lets-try/shooting-with-ra370
Title: Re: Shooting with raycasts
Post by: tcmeric on January 05, 2018, 01:22:45 PM
Hi, first it is important to learn how raycasts work. This short tutorial video shows raycasts in playmaker:
Next, once you have the object you have hit with the raycast, you can use the playmaker action "add force".
Title: Re: Shooting with raycasts
Post by: tcmeric on January 14, 2018, 09:41:08 PM
Hi, I was hoping someone else would answer your question.  ;D Sometimes big questions or big requests are hard to answer. It is important to learn the fundamentals of playmaker.

Did you have a chance to learn how to use the raycast action from the video? Use the raycast to "shoot". Find out what gameobject it hits. Then send an event to that gameobject (enemy) with a custom global event. On this enemy, use the the action "knock back". The raycast will give you the position of the hit normal. Use this position for the knock back action.

Action: https://hutonggames.com/playmakerforum/index.php?topic=14171.0

Or you can apply force if you want to use rigidbody physics.

Here is alternative way to do knockback as well. This one instead of using a normal, calculates the direction between two game objects.  https://hutonggames.com/playmakerforum/index.php?topic=16400.0

Let me know if this helps.  8)

Title: Re: Shooting with raycasts
Post by: jeanfabre on January 23, 2018, 02:12:00 AM
Hi

 Did you checked out the ecosystem sample "RaycastHitNormal" and "GetNextRaycastAllHit" it features all the code to work with raycasts and fire. "GetNextRaycastAllHit" also shows how to check for obstacles.

 Bye,

 Jean