a graph node? New parent to attach graph node too.
Good. Now consider how you are using the function:
Are you passing a pc.GraphNode to the function?
Wait so i did it backwards? or should it be more of missing something? from what i can see with the function i am using ¨Player¨ to reassign as a parent to the weapon or am i reasignning weapon as the parent or neither?
EDIT: ok well the error has gone away now but showing a new one error coding this:
this.root.reparent("Player");
I tried this first but when i reparent i want to make the player the parent right?
So if i mixxed Player with weaponâŚ
More pointed question: Why are you passing a string to a function that is expecting a pc.GraphNode?
Because i thought it would pull the entity instead of the node and it cant do that? what should i put there then? numbers?
OK @yaustar i think i have an idea i was looking at some unity tutorials on this (Yes i know unity is different from playcanvas but helped) This is the question i have now:
link to video
first off GameObject is its own call in CSHARP right?
So if i change this to fit playcanvas how would i fir this?
this.myWeapon;
or
this.weaponOnGround?
also is collide and _collide its own thing in playcanvas? even if its in its own terms?
Please let me know what you think i should/could do
Just one thing, Iâve tried this, but Unity tutorials never work for PlayCanvas . Look at the documentation carefully. The function requires two arguments, the parent, and the index. You are not passing the index argument. Also, the parent argument cannot be a string, but a node.
this.Player.reparent(âAK47â);
Are you passing a pc.GraphNode to the function?
More pointed question: Why are you passing a string to a function that is expecting a pc.GraphNode?
Because i thought it would pull the entity instead of the node and it cant do that? what should i put there then? numbers?
@Nathan_Hawkins1, yaustar was getting you to look closer at what youâre doing.
Instead of passing a graph node, youâre passing a string to the function.
What you need to do is get the graph node, using the string.
Something likeâŚ
var node = this.app.root.findByName(âAK47â);
// Now you have something valid to pass to the reparent function, ie a graph node rather than a string
this.Player.reparent(node);
Oh ok i was so unfocused ya wow im stupid um thanks you guys for the help i will try this out asap thanks @yaustar & @Mal_Duffin & @DevilZ appreciate your patience and help. But i now have another problem @yaustar when i do the collision it does not continue with the player it just changes positions let me know if im missing something
EDIT: calling error on if(result.other.getName() === "AK47" && this.weaponEntity.enabled !== true)
yet it isnt incorrect⌠(FIXED)
EDIT2: Ok Another Problem Now When It Collides the weapon just changes position instead of attaching to the player like it should be this is where i will leave this post @yaustar if you have any suggetion please tell me ive looked all over for the problem but just cant find it
Try setting the coordinates and rotation of the entity
@DevilZ Im taking a break go ahead and take a look at it : https://playcanvas.com/editor/scene/732925