Skip to content

Commit

Permalink
Fixed default cylinder offset and adjustment to physics example
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCreatorGrey committed Aug 24, 2024
1 parent f43cee6 commit ddcbdbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions ursina/models/procedural/cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@


class Cylinder(Pipe):
def __init__(self, resolution=8, radius=.5, start=0, height=1, direction=(0,1,0), mode='triangle', **kwargs):
def __init__(self, resolution=8, radius=.5, height=1, direction=(0,1,0), mode='triangle', **kwargs):
super().__init__(
base_shape=Circle(resolution=resolution, radius=.5),
origin=(0,0),
path=((0,start,0), Vec3(direction) * (height+start)),

path=(
(0,-(height/2),0),
Vec3(direction) *
(height/2)
),

thicknesses=((radius*2, radius*2),),
mode=mode,
**kwargs
Expand All @@ -15,7 +21,7 @@ def __init__(self, resolution=8, radius=.5, start=0, height=1, direction=(0,1,0)

if __name__ == '__main__':
app = Ursina()
Entity(model=Cylinder(6, start=-.5), color=color.hsv(60,1,1,.3))
Entity(model=Cylinder(6), color=color.hsv(60,1,1,.3))
origin = Entity(model='quad', color=color.orange, scale=(5, .05))
ed = EditorCamera(rotation_speed = 200, panning_speed=200)
app.run()
2 changes: 1 addition & 1 deletion ursina/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _convert_shape(shape, entity, dynamic=True):
capsule = Entity(model=Capsule(height=2, radius=.5), texture='brick', y=17)
RigidBody(shape=CapsuleShape(height=2, radius=.5), entity=capsule, mass=3)

cylinder = Entity(model=Cylinder(height=2, radius=.5, start=-1), texture='brick', y=10)
cylinder = Entity(model=Cylinder(height=2, radius=.5), texture='brick', y=10)
RigidBody(shape=CylinderShape(height=2, radius=.5), entity=cylinder, mass=3)

cone = Entity(model=Cone(8, height=2, radius=.5), texture='brick', y=15)
Expand Down

0 comments on commit ddcbdbd

Please sign in to comment.