m |
|||
Line 42: | Line 42: | ||
Space.Host.ExecutingObject.Seat.OnPlayerStandUp(e) | Space.Host.ExecutingObject.Seat.OnPlayerStandUp(e) | ||
− | </pre> | + | </pre>|6= |
+ | <pre>--the below script will teleport the player above the seat after standing up | ||
+ | --so that they do not go back to original position, but rather be standing next to the seat | ||
+ | --(Example: if the seat moves - such as in a vehicle- and we want to stand up next to it) | ||
+ | --[Requires Seat Component in the GameObject running this script] | ||
+ | |||
+ | thisGameObject = Space.Host.ExecutingObject | ||
+ | |||
+ | OnPlayerStandUp = function() | ||
+ | seatPosition = thisGameObject.WorldPosition | ||
+ | teleportPosition = Vector.New(seatPosition.X, seatPosition.Y + 1, seatPosition.Z) | ||
+ | Space.Scene.PlayerAvatar.Teleport(seatPosition) | ||
+ | end | ||
+ | |||
+ | thisGameObject.Seat.OnPlayerStandUp(OnPlayerStandUp)</pre> | ||
}} | }} | ||
Make a player sit.
local seat=thisObject.Children[0].Seat
function Seat()
seat.SitPlayer()
Make a player unseat.
local seat=thisObject.Children[0].Seat
function UnSeat()
seat.UnseatPlayer()
Binds a function to the Seat's On Stand Up event
e = function() Space.Log("On Stand Up event") end Space.Host.ExecutingObject.Seat.OnStandUp(e)
Binds a function to the Seat's On Sit event
e = function() Space.Log("On Sit event") end Space.Host.ExecutingObject.Seat.OnSit(e)
Binds a function to the Seat's On Player Stand Up event which is fired only on the Player's client
e = function() Space.Log("On Player Stand Up") end Space.Host.ExecutingObject.Seat.OnPlayerStandUp(e)
--the below script will teleport the player above the seat after standing up --so that they do not go back to original position, but rather be standing next to the seat --(Example: if the seat moves - such as in a vehicle- and we want to stand up next to it) --[Requires Seat Component in the GameObject running this script] thisGameObject = Space.Host.ExecutingObject OnPlayerStandUp = function() seatPosition = thisGameObject.WorldPosition teleportPosition = Vector.New(seatPosition.X, seatPosition.Y + 1, seatPosition.Z) Space.Scene.PlayerAvatar.Teleport(seatPosition) end thisGameObject.Seat.OnPlayerStandUp(OnPlayerStandUp)
Binds a function to the Seat's On Player Sit event which is fired only on the Player's client
e = function() Space.Log("On Player Sit event") end Space.Host.ExecutingObject.Seat.OnPlayerSit(e)
Whether the seat component is enabled.
Space.Log(seat.Enabled)
Return that whether the seat is in use.
local seat=thisObject.Children[0].Seat
function InUse()
local inUse=seat.InUse
Space.Log(inUse)
Return the ID of the seating player.
local seat=thisObject.Children[0].Seat
function PlaySeated ()
local playSeated=seat.PlayerSeated
Space.Log(playSeated)
Return true if uses SlotID
local seat=thisObject.Children[0].Seat
function UseSlotID ()
local useSlotID=seat.UseSlotID
Space.Log(useSlotID)
Return the slot ID of the seat.
local seat=thisObject.Children[0].Seat
function SlotID ()
local slotID=seat.SlotID
Space.Log(slotID)
Return the clickable collider.
local seat=thisObject.Children[0].Seat
function ClickableCollider()
local clickcoll=seat.ClickableCollider
Space.Log(clickcoll.Enabled)
Return the animation clip.
local seat=thisObject.Children[0].Seat
local animation=seat.Animation
Space.Log(animation.Name)
Return the animation clip.
local seat=thisObject.Children[0].Seat
local animation=seat.AnimationMale
Space.Log(animation.Name)
Return the animation clip.
local seat=thisObject.Children[0].Seat
local animation=seat.AnimationFemale
Space.Log(animation.Name)
|