0 votes

Next problem after change to godot 3.1

W 0:00:03:0671 The method setfriction has been deprecated and will be removed in the future, use physics material instead.
body2d.cpp:634 @ setfriction()
Balls.gd:9 @ add_Ball()
MenuSchlaeger.gd:57 @ _input()

this means this : var ball = BALL_SCENE.instance()

What do I have to do to avoid the error?
The Ball is a rigidbody2d node

extends Node2D

const BALL_SCENE = preload("res://Szenes/Basis/Ball.tscn")
const BULLET_SCENE = preload("res://Szenes/Basis/KanonenBall.tscn")
# Sounds
const Maeeeeh = 10

func add_Ball(pos, vel):
    var ball = BALL_SCENE.instance()
    ball.position = pos
    ball.linear_velocity = vel
    add_child(ball) # Der Ball wird dem Spielfeld hinzugefĆ¼gt
    get_node("/root/Main/AudioPlayer").playSound = Maeeeeh
in Engine by (26 points)

1 Answer

+1 vote

The error means exactly what it says. As of 3.1, physics properties have been moved to a Resource: PhysicsMaterial.

You can see an example of this in use here:

by (21,537 points)

i make in the Ball.tscn a PhysicsMaterial, saved it, that solves my Problem

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.