Skip to content

Commit

Permalink
Update gravity-gun tutorial
Browse files Browse the repository at this point in the history
Network events used the old Events functions for networking
  • Loading branch information
Timmy-the-nobody authored and gtnardy committed Mar 25, 2024
1 parent 9b652b2 commit 06e2a5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/getting-started/tutorials-and-examples/gravity-gun.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ local sm_cube = StaticMesh(Vector(100, 0, 200), Rotator(), "nanos-world::SM_Cube
local sm_cylinder = StaticMesh(Vector(300, 0, 200), Rotator(), "nanos-world::SM_Cylinder")

-- Subscribe for Client's custom event, for when the object is grabbed/dropped
Events.Subscribe("PickUp", function(player, object, is_grabbing)
Events.SubscribeRemote("PickUp", function(player, object, is_grabbing)
object:SetGravityEnabled(not is_grabbing)
object:TranslateTo(object:GetLocation(), 0)
end)

-- Subscribe for Client's custom event, to update the position of the object he is grabbing
Events.Subscribe("UpdateObjectPosition", function(player, object, location)
Events.SubscribeRemote("UpdateObjectPosition", function(player, object, location)
object:TranslateTo(location, 0.1)
end)
```
Expand Down

0 comments on commit 06e2a5a

Please sign in to comment.