0 votes

I wanted to spawn the player and move the camera towards the player.
However, if the colliding body is a tree, I cant set the camera target, so the camera remains at Vector3(0, 0, 0).
It was working fine until I made some changes in the player spawning system to add some features using the PhysicsDirectSpaceState.
Below is my code(Not the full one, just the part where I think is related):

There are also some errors, but I'm not sure whether it's related.
Below are the errors:
1) E 0:00:05.594 restinfo: The shape is not a convex shape, then is not supported: shape type: 7
<C++ Source> modules/bullet/space
bullet.cpp:247 @ rest_info()
LandGenerator.gd:290 @ collide()
LandGenerator.gd:295 @ checkCollision()
LandGenerator.gd:145 @ placeObj()
grass.gd:16 @ chooseObj()
biome.gd:58 @ loopFill()
biome.gd:27 @ _ready()
LandGenerator.gd:140 @ placeLand()
LandGenerator.gd:120 @ createWorld()
LandGenerator.gd:55 @ _ready()
World.gd:12 @ _ready()

2) E 0:00:05.618 getpathto: Condition "!commonparent" is true. Returned: NodePath()
<C++ Source> scene/main/node.cpp:1619 @ get
LandGenerator.gd:248 @ setPlayerPos()
LandGenerator.gd:269 @ reSpawn()
water.gd:17 @ _process()

Finally, if there is any extra information, data or methods you all need to be able to help me, please ask..thanks...

I've debugged the code for hours, but to no avail...Hope someone can help me soon...

in Engine by (46 points)

Have you tried NodePath

'export (NodePath) var target = get_node("where is that node")'

I've solved it,its because I need to delete the previous camera first before adding a new one...thanks anyways..

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 webmaster@godotengine.org with your username.