The billboard function should not shrink or lengthen the sprite, it should just make it look at you.
If you want only the Y rotation to change, maybe this can do it:
var camera_pos = get_viewport().get_camera().global_transform.origin
camera_pos.y = 0
look_at(camera_pos, Vector3(0, 1, 0))
I think there is a way using a custom shader but I don’t have the math in mind.
Edit: oh wait, there is an Y-billboard mode in
SpatialMaterial… I tried it and it works well, why is this not suitable? Are you using Godot 2 or 3?
Ok i tried your code and i think we’re so much close, the only problem is that when im in front of the sprite this one inclines to me, and if i pass through him he gives a 360° turn in X axis, but dude thank you finally something works
About Y-Billboard i tried that too and actually it works perfectly, the problem? i dont know why but the sprite turns fat, literally, its X-Scale grows and i cant change it even if i use the Scale Mode or if i manually decrease its X-Scale in Inspector menu, but the Y rotation works perfectly, using Godot 3. Now, being a SpatialMaterial, i put the Transparent, Unshaded and Albedo Tex For flags in order to make it visible and in good quality, im not sure if one of those flags makes the Y-billboard not suitable (pretty much sure its not that) or maybe my sprite was made wrongly (could be), or maybe is my version of godot, are you using godot 2?
andrew012623 | 2018-07-05 04:59
You know what? i think its my sprite, maybe it is wrong after all, im drawing a character in flash professional cc, and then i export it as a sprite sheet, i guess thats the problem, because after trying the Y-billboard with the godot icon worked well, so it seems that the real question is how can i make my flash drawing a sprite correctly? how do you make your sprites? any program in particular?
andrew012623 | 2018-07-05 10:28
Ugh, well any PNG or atlas should work normally. If an atlas causes problems then you probably hit a bug^^ Do you have an example project I can checkout?
Zylann | 2018-07-06 00:32
Hey buddy dont worry, i finally solved it! using Y-Billboard function, but thank you for all the help, i appreciate it, actually if you hadnt mentioned the billboard i wouldnt insist with it and i would be struggling. Thank you!!
andrew012623 | 2018-07-06 21:27
This worked wonderfully. Thanks.
animanoir | 2022-01-22 05:41