initial commit
This commit is contained in:
commit
79951d8075
22 changed files with 729 additions and 0 deletions
36
gears/ball.gd
Normal file
36
gears/ball.gd
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
class_name Ball extends "gear.gd"
|
||||
|
||||
func gear_name():
|
||||
return "Ball"
|
||||
func gear_id():
|
||||
return 1
|
||||
func continuous():
|
||||
return false
|
||||
|
||||
func make_ball(player):
|
||||
var ball = RigidBody3D.new()
|
||||
var cs = CollisionShape3D.new()
|
||||
cs.shape = SphereShape3D.new()
|
||||
ball.name = "Ball"
|
||||
ball.mass = 4
|
||||
ball.position = Vector3.ZERO
|
||||
ball.global_transform = Transform3D(
|
||||
player.get_node("Pivot/Container").global_transform)
|
||||
|
||||
ball.set_collision_layer_value(1, false)
|
||||
ball.set_collision_layer_value(3, true)
|
||||
ball.set_collision_mask_value(3, true)
|
||||
|
||||
var mesh = $GearMesh.duplicate()
|
||||
mesh.position = Vector3.ZERO
|
||||
ball.add_child(mesh)
|
||||
ball.add_child(cs)
|
||||
|
||||
return ball
|
||||
|
||||
func on_use(player):
|
||||
var ball = make_ball(player)
|
||||
var impulse = player.get_node("CameraGimbal").basis.z * -64
|
||||
impulse.y = 4
|
||||
ball.apply_central_impulse(impulse)
|
||||
player.add_sibling(ball)
|
||||
Loading…
Add table
Add a link
Reference in a new issue