I cannot find any method in document(pc.Vec3). there is only one method call “project” but this function is project a point to a vector.
Please help.
Hi @ZipZapWxh,
You can use something similar with the example provided in the documentation for the Vec3 project method.
The normal in this case would be the vector pointing outwards from the surface:
// vec is your vector
// normal is the vector pointing outwards from the horizontal surface
var normal = new pc.Vec3(0, 1, 0);
vec.project(normal);
console.log("The result of the vector projection is: " + vec.toString());
1 Like
Thank you so much. I will try this when I wake up. It’s 5am China time.
2 Likes
It’s seems not work in my case…
Can you provide us with a sample project?