it says that getKeyDown does not exist on the Input module, same as for the transform
by user 483253293477265409
it says that getKeyDown does not exist on the Input module, same as for the transform
by user 483253293477265409
transform, it is this.gameObject.positionthis.context.inputMaybe have a look at Needle Engine for Unity Developers | Needle Engine Documentation
Thanks, that was very useful. And one more question, is it possible to make something like “public GameObject name” on javascript? or do I have to create a separate specific class and then import it?
by user 483253293477265409
That’s:
@serializable(GameObject)
public myObjects : GameObject[];
or Object3D from threejs instead of GameObject. It’s interchangeable
See some examples here: Script Examples | Needle Engine Documentation
thank you marcel. with the help of the documentation and what you told me I’ve got to this point, where there is no more editor errors and no more errors that I’m aware of but when I apply this script to a gameobject in unity then it doesn’t do anything, do you have any idea of what could be happening? thanks in advance
by user 483253293477265409
the event methods are update and awake and not onInit or onUpdate. Where did you get the method names from? Please have a look at Needle Engine Scripting | Needle Engine Documentation
Why are you creating a new physics world? A rapier physics world is already initialized by the physics module (this.context.physics)
because I didn’t know how to access the gravity with that module and if I created one with the World class then I knew there was a gravity component there
by user 483253293477265409
Im exposing it in the new version
about to publish
nice, I’ll wait for it then, thanks for the update. Taking a quick glance at my code, do you see if I am doing something that is pretty obvious that I’m doing wrong? If not, thanks for all the help, I’m super bad at programming and this is being pretty confusing up to this point
by user 483253293477265409
Its up!
When looking at the code one thing that stands out is that you create a lot of threejs objects in the update loop (Vector3 and Quaternions via new and clone()). If you get that version working this would be something that I’d maybe change (e.g. you can save the axis vector3s easily in a private field instead of creating a new vector with (0, 1, 0) every frame in line 50 for example)
Another thing I always try to do is to make sure I use constand let to mark my intention. const can not be re-assigned whereas let can
Let me know when you tried the new version. You can set/access the gravity like so: this.context.physics.gravity
The gravity against the planet is working but the controller for the character goes crazy. the player (a capsule) is rotating endlessly and the movement is not working as supposed to
by user 483253293477265409