Skip to main content
  1. Tech/

Script inherits from native type 'RigidBody2D', so it can't be assigned to an object of type: 'Node2D'

·1 min

Getting this error while following this tutorial in Godot v4.0.1.

In my case, I had added Node2D. The fix was to right-click on the problem node under Scene and click Make Scene Root. And then delete Node2D.

Here is what diff looked like:

diff --git a/2d-game-tutorial/Mob.tscn b/2d-game-tutorial/Mob.tscn
index 9eb1630..e720d7f 100644
--- a/2d-game-tutorial/Mob.tscn
+++ b/2d-game-tutorial/Mob.tscn
@@ -48,20 +48,18 @@ animations = {
 radius = 36.0
 height = 100.0

-node name="Mob" type="Node2D"]
-script = ExtResource("1_73gb4")
-
-node name="RigidBody2D" type="RigidBody2D" parent="."]
+node name="RigidBody2D" type="RigidBody2D"]
 collision_mask = 0
 gravity_scale = 2.66454e-15
+script = ExtResource("1_73gb4")

-node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="RigidBody2D"]
+node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
 scale = Vector2(0.75, 0.75)
 sprite_frames = SubResource("SpriteFrames_c1yjy")
 animation = &"walk"

-node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
+node name="CollisionShape2D" type="CollisionShape2D" parent="."]
 rotation = 1.5708
 shape = SubResource("CapsuleShape2D_h1pjc")

-node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="RigidBody2D"]
+node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]

Related

How much can you really get out of a 4$ VPS?

·1 min
I am a big fan of cheap VPSs. I start many personal projects, bring up a VPS, play around and then wipe it. Never have to worry about accidentally running up a bill in 100s or 1000s of dollars. I run this blog on a $4 server. So this was interesting to read how far can a cheap VPS go.

How to backup Kubernetes' Config

·1 min
The easiest solution seems to be the following script by Stack Overflow user, Timothy Perez : <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">#!/bin/bash # NAMESPACED EXPORTS for ns in $( kubectl get ns --no-headers | cut -d " " -f1 ) ; do kubectl --namespace = " ${ ns} " get -o = json bindings,cm,ep,ev,limits,pvc,po,podtemplates,rc,quota,secrets,sa,svc,controllerrevisions,ds,deploy,rs,sts,localsubjectaccessreviews,hpa,cj,jobs,leases,ev,ds,deploy,ing,netpol,rs,pods,netpol,pdb,roles,rolebindings | \ jq '.items[] | select(.type!="kubernetes.io/service-account-token") | del( .spec.clusterIP, .metadata.uid, .metadata.selfLink, .metadata.resourceVersion, .metadata.creationTimestamp, .metadata.generation, .status, .spec.template.spec.securityContext, .spec.template.spec.dnsPolicy, .spec.template.spec.terminationGracePeriodSeconds, .spec.template.spec.restartPolicy )' >> "./ ${ ns} .json" done # NON-NAMESPACED EXPORTS kubectl get -o = json cs,ns,no,pv,mutatingwebhookconfigurations,validatingwebhookconfigurations,crds,apiservices,tokenreviews,selfsubjectaccessreviews,selfsubjectrulesreviews,subjectaccessreviews,csr,psp,nodes,psp,clusterrolebindings,clusterroles,pc,sc,volumeattachments | \ jq '.items[] | select(.type!="kubernetes.io/service-account-token") | del( .spec.clusterIP, .metadata.uid, .metadata.selfLink, .metadata.resourceVersion, .metadata.creationTimestamp, .metadata.generation, .status, .spec.template.spec.securityContext, .spec.template.spec.dnsPolicy, .spec.template.spec.terminationGracePeriodSeconds, .spec.template.spec.restartPolicy )' >> "./cluster_non-namespaced_export.json" Script copied here under CC BY-SA 4.0 license

Kubernetes not passing full path to Nodejs

·1 min
I spent hours troubleshooting why the url path was getting stripped from requests in our Nodejs/Expressjs based app. The reason was this line in Kubernetes’ Ingress: nginx.ingress.kubernetes.io/rewrite-target : / Removing it fixed the issue. Check the Kubernetes documentation for more details.