- Home /
Creating platform that is only solid from the top
The reason I'm saying "only solid from the top" is because if I try to look up "one-sided platform", the tutorials I find have the issue that the platform's sides are solid as well. This is not what I want, so I'd need to know how to make only the top of the platform solid and all other sides non-solid. At the moment the platform has a Platform Effector 2D, but I'm not sure if you can modify it to make the sides non-solid. Another important feature would be that you can drop down the platform if you hold down and press jump. It should only affect that one platform and not fall through all platforms if you keep holding them (like in Starbound). The current code to drop down the platform is set up like this, but it doesn't seem to work:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformFall : MonoBehaviour {
private PlatformEffector2D effector;
// Use this for initialization
void Start ()
{
effector = GetComponent<PlatformEffector2D>();
}
// Update is called once per frame
void Update ()
{
if(Input.GetKey(KeyCode.DownArrow) && Input.GetButtonDown("Jump"))
{
effector.rotationalOffset = 180.0f;
}
else
{
effector.rotationalOffset = 0.0f;
}
}
}
Comment