playMaker

Author Topic: Terrain Detection (Solved)  (Read 1716 times)

Bainto

  • Playmaker Newbie
  • *
  • Posts: 36
Terrain Detection (Solved)
« on: June 25, 2018, 08:50:58 AM »
Is there anyway to create a terrain detection script for a char, where instead of playing the basic clopping of the prefab it plays sounds based on what terrain the char is on?
« Last Edit: July 02, 2018, 09:37:34 PM by Bainto »

verybinary

  • Junior Playmaker
  • **
  • Posts: 81
    • The Museum of Digital
Re: Terrain Detection
« Reply #1 on: June 26, 2018, 10:50:06 AM »
when character is grounded, raycast down, compare the name of the hit object with events and send to the event that plays the correct sound.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Terrain Detection
« Reply #2 on: June 26, 2018, 07:22:56 PM »
Hi.
You can also compare the material if materials are changing during run time on the object.
This way you can dynamically change the effects on the same object.

Bainto

  • Playmaker Newbie
  • *
  • Posts: 36
Re: Terrain Detection
« Reply #3 on: June 26, 2018, 10:09:28 PM »
I have probably 5 different terrains or so that the char will play on is there anyway id be able to have a bit more detail as im really new XD ty for the help and ill attempt to figure it out in the meantime with the thought of using raycasting.

Bainto

  • Playmaker Newbie
  • *
  • Posts: 36
Re: Terrain Detection
« Reply #4 on: June 29, 2018, 05:17:22 PM »
and.... im lost lol

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Terrain Detection
« Reply #5 on: June 30, 2018, 12:38:25 PM »
Hi. do you understand how  raycast works?

with the raycast you need to detect the ground object, then you can get the name/layer/tag/material and so on from that object.

Then you can use that information to determine what terrain you are on.

Here is one of my older videos about raycast :


Bainto

  • Playmaker Newbie
  • *
  • Posts: 36
Re: Terrain Detection
« Reply #6 on: July 01, 2018, 05:00:24 AM »
ty ill try this in the am :D