๐ŸงบPlace Point

Place points allow grabbables to be placed in predetermined points or areas. By default place points will accept an item when the player releases it within the place radius, if that item meets the place requirements

Place Settings

  • Start Placed leave empty if none, will automatically place this object on start regardless of position

  • Placed Offset represents the center of the place point. If empty will default to local transform

  • Placed Radius is the distance from the placed offset that placement is allowed

  • Parent on Place if true, the placed grabbable will be parented under the placed offset on place

  • Force Place if true, the place point will automatically place a grabbable (meeting placement requirements) as soon as it enters the place area regardless of whether the object has been released or not

  • Force Hand Release if true, the place point will force the hand to drop the object when it's placed in the place point.

    • Even if this is false, hand will sometimes force release grabbable on place if the hand teleports too far from the controller or the grabbable break force is too low

  • Destroy Object On Place if true, the placed object will be destroyed on place

  • Disable Rigidbody On Place if true, a placed grabbable will lose its rigidbody while being placed in this place point (adds rigidbody back when grabbed again)

  • Disable Grab On Place if true, a placed grabbable will no longer be grabbable after placed in this place point

  • Disable Place Point On Place if true, the place point will be deactivated after an object is placed and the place point and will no longer be useable (unless reenabled)

  • Make Placed Kinematic if used, this will set the placed objects rigidbody to be kinematic while in the place point

  • Placed Joint Link If used, this will create a fixed joint between the placed object and the included rigidbody on place (will not work with Make Place Kinematic)

  • Joint Break Force (if using the placed joint link) the joint break force to use on the placed joint link

Place Requirements

  • Name Compare Type

    • Name will compare the objects name to the place names and blacklist names to check if placement is allowed

    • Tag will compare the objects tag to the place names and blacklist names to check if placement is allowed

  • Place Names will compare the attempted placed object (based on the compare type) to all the names/tags in this list to see if they will be allowed placement.

    • If it's a name comparison it will check if the name CONTAINS the included word, for example blue will allow object named blue_car to be placed

  • Blacklist Names will compare the attempted placed object (based on the compare type) to all the names/tags in this list to see if they will NOT be allowed placement.

    • If it's a name comparison it will check if the name CONTAINS the included word, for example car will NOT allow object named blue_car to be placed

  • Only Allows if used, place point will only accept grabbables included in this list

  • Dont Allows if used, place point will not accept grabbables included in this list

  • Place Layers only allows objects in these physics layers to be placed. By default if set to Nothing will be set to Grabbable on start. (Setting to Everything is not recommended as it is more expensive)

  • Held Place Only if true the placement is only allowed while the grabbable is being held or released by a hand

Events

On Place occurs when a valid placement happens

On Remove occurs when a placed object is grabbed.

On Highlight occurs when a valid object enters a place area before it's released and placed

On Stop Highlight occurs when a valid object leaves a place area

Programming Info

Place Points are also manageable though code with these functions

//Will accept a grabbable, if "CanPlace()" flag is cleared and nothing is currently place
placePoint.Place(Grabbable grabbable)

//Removes what is in it, if it matches the current placeObject
placePoint.Remove(Grabbable grabbable)

//Getter for the current place object in the place point -> returns null if none
placePoint.placedObject 

//Getter for the current highlight object in the place point -> returns null if none
placePoint.highlightingObj

Connect Place Point events through a custom script

using UnityEngine;
using Autohand;

public class PlacePointEventTemplate : MonoBehaviour {
    public PlacePoint placePoint;

    void OnEnable() {
        placePoint.OnPlaceEvent += OnPlace;
        placePoint.OnRemoveEvent += OnPlace;
        placePoint.OnHighlightEvent += OnHighlight;
        placePoint.OnStopHighlightEvent += OnStopHighlight;
    }

    private void OnDisable() {
        placePoint.OnPlaceEvent -= OnPlace;
        placePoint.OnRemoveEvent -= OnPlace;
        placePoint.OnHighlightEvent -= OnHighlight;
        placePoint.OnStopHighlightEvent -= OnStopHighlight;

    }

    public void OnPlace(PlacePoint point, Grabbable grab) {
        //Stuff happens when placed
    }

    public void OnRemove(PlacePoint point, Grabbable grab) {
        //Stuff happens when placed was removed

    }
    public void OnHighlight(PlacePoint point, Grabbable grab) {
        //Stuff happens when placepoint was highlighted

    }

    public void OnStopHighlight(PlacePoint point, Grabbable grab) {
        //Stuff happens when placepoint was done highlighting
    }
}

Last updated