Skip to content

Commit

Permalink
Fixed world collision. Ralph should again be able to smack into trees.
Browse files Browse the repository at this point in the history
  • Loading branch information
svf committed Apr 25, 2021
1 parent 91416c4 commit 6750e0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions samples/roaming-ralph/ralph_helpers/input.py
Expand Up @@ -25,8 +25,6 @@ def __init__(self, app) -> None:
# Game state variables
self.isMoving = False



self.app.disableMouse()

# Records the state of the arrow keys
Expand All @@ -43,6 +41,7 @@ def updateCamera(self, dt):
self.app.camera.setX(self.app.camera, +20 * dt)

def updateRalph(self, dt):
self.app.startpos = self.app.scene.ralph.getPos()
# If a move-key is pressed, move ralph in the specified direction.

if self.keyMap["left"]:
Expand Down
6 changes: 2 additions & 4 deletions samples/roaming-ralph/ralph_helpers/physics.py
Expand Up @@ -45,9 +45,7 @@ def __init__(self, app) -> None:

def update(self, render):
# save ralph's initial position so that we can restore it,
# in case he falls off the map or runs into something.

startpos = self.app.scene.ralph.getPos()
# in case he falls off the map or runs into something.

self.cTrav.traverse(render)
# Adjust ralph's Z coordinate. If ralph's ray hit terrain,
Expand All @@ -60,4 +58,4 @@ def update(self, render):
if len(entries) > 0 and entries[0].getIntoNode().name == "terrain":
self.app.scene.ralph.setZ(entries[0].getSurfacePoint(render).getZ())
else:
self.app.scene.ralph.setPos(startpos)
self.app.scene.ralph.setPos(self.app.startpos)

0 comments on commit 6750e0b

Please sign in to comment.