This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

My script as follows deriving from a RigiBody, throwing RigidBody balls

please explain me how to raycast3d to open space. Also my ball instances are not going as speedy as it should be. For instance I want it powerfull

if not Joystick.get_node("LeftAnalog").get_rect().has_point(event.position) and not Joystick.get_node("RightAnalog").get_rect().has_point(event.position) and not Joystick.get_node("PitchAnalog").get_rect().has_point(event.position) and not Joystick.get_node("ControlCamera").get_rect().has_point(event.position):
            if abs(Joystick._dir.y) > 0 or abs(Joystick._dir.x) > 0:
                ray_length = 1000
                if event is InputEventScreenTouch:
                    mouse_pos = event.position
                    get_node("Spatial/InterpolatedCamera/look_at2/Sprite").transform.origin = mouse_pos
                    camera = cameravi
                    from = camera.project_ray_origin(mouse_pos)
                    to = from + camera.project_ray_normal(mouse_pos) * ray_length
                    space_state = get_world().get_direct_space_state()
                    result = space_state.intersect_ray(from, to )
                    if result.has("position"):
                        var op = load("res://Scenes/SceneObjects/RigidBallInstance.tscn").instance()
                        get_node("..").add_child(op, true)
                        op.scale = Vector3(0.1,0.1,0.1)
                        op.mass = 1
                        op.angular_damp = -1
                        op.linear_damp = 0.18
                        holder = get_parent().get_node("InterpolatedCamera/look_at2")
                        holder2 = $look_at3
        #               op.set_global_transform(holder2.get_global_transform())
                        op.transform.origin = Vector3(holder2.get_global_transform().origin.x,holder2.get_global_transform().origin.y + 5,holder2.get_global_transform().origin.z)
                        look_vector = (Vector3(result.position.x, result.position.y, result.position.z) - get_parent().get_node("InterpolatedCamera").get_global_transform().origin).normalized()
#                           get_parent().get_node("InterpolatedCamera/look_at2").transform.origin = Vector3(12,43, 2)
                        get_node("Spatial/InterpolatedCamera/look_at2").transform.origin = Vector3(12,43, 2)
                        op.apply_impulse(Vector3(), get_node(".").look_vector * Vector3(333, 333, 333)) 
in Engine by (193 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.