Materials are not working properly

Hi!

I’m trying to make a small project in Godot after finishing the Project Boost section.

I’ve stuck at a small problem. I made a new scene called “Success_Box” and its purpose is to display particles and end the game as soon as the player touches the box. I gave it a green material which looks like this:

And when I tried instantiating this scene is another scene, the materials did not upload:

Please help me out as I’ve been stuck on this for a while now.

Another problem I’ve got is, the player keeps vibrating when I run the scene, apparently I can’t upload a video of that, put the cylinder keeps shaking and changes its position.

Please help me out

I’m assuming what we’re seeing in the second screenshot is a Success Box that you’ve already resized.

I don’t know why this would happen as I’ve never experienced anything like that, and I couldn’t reproduce the issue when I tried just now. You might want to try remaking the Success Box scene (if you save your material as a .tres file first, this will take all of 10 seconds to try). Failing that, if you post your Inspector maybe we’ll see something out of place.

This sounds like you are mixing dynamic and kinematic movement in the same frame. In other words, it sounds like you are moving the rocket both using Godot’s physics engine (apply_central_force(), apply_torque()) and by setting things like position and rotation directly somehow. When you do the latter while also using physics functions, the physics engine needs to incorporate your kinematic movement into the final result, and it will struggle to do this, producing rubber-banding depending on exactly what you’re doing.

While it’s possible to make it work properly in some situations, for the purposes of this project, I would remove any kinematic movement or rotation you’re doing and stick to just using apply_central_force() and apply_torque(). Hopefully that’s what’s going on. Can you post the player script so we can have a look?

1 Like

Sure, Here’s the player script:

extends RigidBody3D

@export var thrust: float = 1000
@export var sideways_thrust: float = 1000
@export var jump: float = 1000

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	
	if Input.is_action_pressed("Forward"):
		apply_central_force(Vector3(0.0, 0.0, -thrust * delta))
		
	if Input.is_action_pressed("Backward"):
		apply_central_force(Vector3(0.0, 0.0, thrust * delta))
		
	if Input.is_action_pressed("Right"):
		apply_central_force(Vector3(sideways_thrust * delta, 0.0, 0.0))
		
	if Input.is_action_pressed("Left"):
		apply_central_force(Vector3(-sideways_thrust * delta, 0.0, 0.0))
		#apply_central_force(basis.x * (-thrust * delta))
		
	if Input.is_action_pressed("Jump"):
		apply_central_force(Vector3(0.0, jump * delta, 0.0))
	

This is my player script, Im using only (apply_central_force() and apply_torque()).

I didn’t quite get this part of your reply

and by setting things like position and rotation directly somehow

what I’m assuming is you meant I changed the position and rotation by using the gizmos or the the values under transform properties. Correct me if I was wrong there.

And I guess I figured out the material problem. The root node of Success_Box is CSGShape_3D node, and when I make it a child of base_level whose root node is CSGShape_3D node, it inherits its Geometry properties which again makes it plain white.

When I make Success_Box a child of player(or any other node), it again gets its green colour

Based on your script, no worries, it’s clearly something else (and I was actually hoping this would be the case, as kinematic movement doesn’t make sense for this project) =)

Does this vibration happen independently of any input you give it? I wonder if it’s an internal collision issue; I had some similar problems early on in my own project.

1 Like

Does this vibration happen independently of any input you give it? I wonder if it’s an internal collision issue; I had some similar problems early on in my own project.

Yes, this vibration happens independently all by itself.

I wonder if it’s an internal collision issue

I think that’s what I’m dealing with, do you know how to solve it?

And I went to the internet to find the solution to the materials problem, still no solution, went back to the lectures as I think they gave a way to fix that, but still couldn’t find anything useful.

I think this will explain things (and the solution is also very simple); I hadn’t considered this possibility since there’s no combiner here, but reading this reminded me that this is actually expected behaviour:
https://www.reddit.com/r/godot/comments/17tu4it/children_of_csg_nodes_inheriting_parent_nodes/

As far as the collision issue is concerned, I don’t remember it 100% because it was quickly fixed, but I believe it was because I accidentally had some of the shapes intersecting with each other. This was before I disabled their individual collisions and gave the whole Player its own single overriding CollisionShape.

As a quick test, if you disable collision entirely on your Player, you should find that the stuttering stops (maybe you already did this, but I figured I’d mention it just in case). Getting a good collision setup will then be your next step from there, and for the purpose of prototyping, it could be as simple as dumping a capsule on top of the whole Player. Lots of time to get fancier later on if you want, right? =)

1 Like

I think this will explain things (and the solution is also very simple); I hadn’t considered this possibility since there’s no combiner here, but reading this reminded me that this is actually expected behaviour:
https://www.reddit.com/r/godot/comments/17tu4it/children_of_csg_nodes_inheriting_parent_nodes/

That actually worked, the solution was pretty simple though, I was just stupid enough not to figure it out.

but I believe it was because I accidentally had some of the shapes intersecting with each other

I guess that’s the issue occurring here, as the player slides on the platform provided to it.

But anyways, I found the solution to the collision thing!

I gave the CollisionShape3d a new cylinder shape and scaled it to be a little longer then the player, and guess what, the stuttering stopped right after that!

I sincerely thank you mate, you were very helpful, thanks a lot :wink: :wink:

1 Like

:+1:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms