collision⚓︎
This event is triggered on a collision and all the frames during the collision.
--- @param e collisionEventData
local function collisionCallback(e)
end
event.register(tes3.event.collision, collisionCallback)
Tip
This event can be filtered based on the reference
event data.
Tip
An event can be claimed by setting e.claim
to true
, or by returning false
from the callback. Claiming the event prevents any lower priority callbacks from being called.
Event Data⚓︎
mobile
(tes3mobileObject): Read-only. Mobile object which collided with its target reference.reference
(tes3reference): Read-only. Mobile object's associated reference.target
(tes3reference): Read-only. Reference which mobile object has collided with.
Examples⚓︎
Example: Shows a message when the player bumps into the door.
local function onCollision(e)
local target = e.target
if not target then
return
end
if target.object.objectType == tes3.objectType.door then
tes3.messageBox("Ouch!\nMaybe I should open it first?")
end
end
event.register(tes3.event.collision, onCollision, { filter = ("PlayerSaveGame"):lower() })