Skip to content

Commit

Permalink
Carts: Get rid of animation hack
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu committed Jun 1, 2022
1 parent 54dc58e commit c1df5b9
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 12 deletions.
15 changes: 3 additions & 12 deletions mods/carts/cart_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ local S = carts.get_translator
local cart_entity = {
initial_properties = {
physical = false, -- otherwise going uphill breaks
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "carts_cart.b3d",
visual_size = {x=1, y=1},
mesh = "carts_cart.obj",
textures = {"carts_cart.png"},
},

Expand Down Expand Up @@ -352,15 +351,7 @@ local function rail_on_step(self, dtime)
elseif dir.z < 0 then
yaw = 1
end
self.object:set_yaw(yaw * math.pi)

local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}
elseif dir.y == 1 then
anim = {x=2, y=2}
end
self.object:set_animation(anim, 1, 0)
self.object:set_rotation(vector.new(math.sign(dir.y) * 0.25 * math.pi, yaw * math.pi, 0))

if update.vel then
self.object:set_velocity(vel)
Expand Down
Binary file removed mods/carts/models/carts_cart.b3d
Binary file not shown.
80 changes: 80 additions & 0 deletions mods/carts/models/carts_cart.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Blender v2.82 (sub 7) OBJ File: 'carts_cart.blend'
# www.blender.org
mtllib carts_cart.mtl
o Cube
v -5.000000 -5.000000 5.000000
v -5.000000 -5.000000 -5.000000
v 5.000000 -5.000000 -4.999999
v 4.999998 -5.000000 5.000002
v -5.000002 5.000000 4.999997
v -4.999997 5.000000 -5.000003
v 5.000002 5.000000 -4.999998
v 5.000000 5.000000 5.000000
v -4.324999 5.000000 -4.325001
v -4.325000 -4.325000 -4.325000
v 4.325001 5.000000 -4.325003
v 4.324999 5.000000 4.324998
v 4.325000 -4.325000 -4.325001
v 4.325000 -4.325000 4.324999
v -4.324998 5.000000 4.324999
v -4.324999 -4.325000 4.325000
vt 0.500000 -0.000000
vt -0.000000 0.000000
vt -0.000000 0.500000
vt 0.500000 0.500000
vt 1.000000 0.500000
vt 0.500000 1.000000
vt 1.000000 1.000000
vt 0.500000 1.000000
vt 0.500000 0.500000
vt 1.000000 0.500000
vt 1.000000 1.000000
vt 0.500000 -0.000000
vt 0.500000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.000000
vt 1.000000 0.500000
vt 0.500000 0.500000
vt 0.500000 -0.000000
vt 1.000000 0.000000
vt 0.031250 0.531250
vt 0.031250 1.000000
vt 0.468750 1.000000
vt 0.468750 0.531250
vt 0.031250 0.531250
vt 0.031250 1.000000
vt 0.468750 1.000000
vt 0.468750 0.531250
vt 0.468750 0.968750
vt 0.031250 0.968750
vt 0.031250 0.531250
vt 0.468750 0.531250
vt 0.468750 0.531250
vt 0.031250 0.531250
vt -0.000000 0.500000
vt 0.500000 0.500000
vt 0.468750 0.968750
vt 0.000000 1.000000
vt 0.031250 0.968750
vn 0.0000 -1.0000 -0.0000
vn -1.0000 0.0000 -0.0000
vn 1.0000 -0.0000 0.0000
vn -0.0000 0.0000 1.0000
vn 0.0000 -0.0000 -1.0000
vn 0.0000 1.0000 0.0000
usemtl Material
s off
f 2/1/1 3/2/1 4/3/1 1/4/1
f 2/5/2 1/4/2 5/6/2 6/7/2
f 8/8/3 4/9/3 3/10/3 7/11/3
f 4/12/4 8/13/4 5/14/4 1/15/4
f 6/16/5 7/17/5 3/18/5 2/19/5
f 14/20/2 12/21/2 11/22/2 13/23/2
f 10/24/3 9/25/3 15/26/3 16/27/3
f 16/28/6 14/29/6 13/30/6 10/31/6
f 16/27/5 15/26/5 12/21/5 14/20/5
f 9/25/4 10/24/4 13/23/4 11/22/4
f 9/32/6 11/33/6 7/34/6 6/35/6
f 9/32/6 6/35/6 5/6/6 15/36/6
f 15/36/6 5/6/6 8/37/6 12/38/6
f 12/38/6 8/37/6 7/34/6 11/33/6

0 comments on commit c1df5b9

Please sign in to comment.