Move imported mesh

Hello.

When working on my game I have the fov of the camera zoomed in to “aim” the weapon. I also need to move the weapon in order to aim down iron sights. I have the weapon and the arms as a single .babylon file, and I have them as a child to a transform node. I am not able to change the position of the transform node after the model loads. It worked ONCE, but I changed the position of the transform node at the start and it stopped working. any help would be great.

Thanks, Givo.

PS: I am asking for help so much on these forums, I’m gonna credit the top 5 people who have helped me!:smiley:

We need a repro in the PG to help (as usual :))

I’ll try, but the playground doesn’t like my gitlab hosted models. Here is the link to the model: viewmodeltest.babylon

Check out my website giv0.gitlab.io/fpsg. The viewmodel looks good! Right click to “aim”!

Well here is a doc for that:Using External Assets - Babylon.js Documentation
It is clearly easier to help you if you can repro in the playground

I didn’t know about that. I’ll make the playground now :slight_smile:

Here

I followed the steps but it didn’t show up :frowning:

Well this link seems not to work
https://cdn.jsdelivr.net/gh/giv0/fpsg/raw/2dd8ceae07176125d6b8a8585b2d330ccffb1f72/assets/viewmodeltest.babylon

hmmmmmmmmmmmmmmmmmmmmmmmmmmmmm…

could you try to modify the link? It was in my second post.

Not sure to get what you want me to do :smiley:

In your second post, you had the link to the using external assets page. In MY second post, i had the model’s link. I modified it and you showed that it didn’t work. I was wondering if you could try to change the link to work in the playground. I’ll try again, though.

wait a minute. it uses gitHUB. I use gitLAB. I wonder if that has something to do with it not working.

ok :slight_smile:

I don’t know for gitlab to be honest. But if your problem is not related to the mesh directly maybe you can just recreate your problem with spheres and boxes

I can’t recreate it. The sphere works fine. I had it working ONCE but then I changed the value of the position and it stopped working.

I use gitlab because I like it’s web ide.

ok so repro is mandatory :smiley:

Yes, I would say so too.

I could use the “dude” model to recreate it.

good idea

TA DAA

Here it is! On right click, the camera zooms in. Dude should move down. he doesn’t. YAY a repro!

wait… why am I happy about an issue?

Hi @Givo You’re declaring " vmtp " inside the sceneloader success callback, but try to access/change it on pointer down/up (out of scope).

you should instead do something like this:

var vmtp;
BABYLON.SceneLoader.ImportMesh("him", "/scenes/Dude/", "Dude.babylon", scene, function(newMeshes) {
    vmtp = new BABYLON.TransformNode();

Oh. I tried moving it outside, but not like that. I’ll try it. thanks!