Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carts: Get rid of animation hack #2958

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
76 changes: 76 additions & 0 deletions mods/carts/models/carts_cart.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
o Cart
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
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