[SOLVED] API reference on force attribute


Where can I find info in the API reference on the force attribute (or variable) like in this code?
this.force = new pc.Vec3();

@jayypeak Here are some good places to look at.

PlayCanvas API Reference

User Manual | Learn PlayCanvas


Hi, thanks for the suggestion but I searched a lot in the API Reference but was not able to find the class where force is described.

@jayypeak Sorry I guess I missed that. So this.force is actually a new Vec3 object.

    // Check if what I hit has rigid body
    if(rsltEntity.rigidbody != null) {

        this.force = new pc.Vec3();

It’s name “force” is just used to designate it in the code. It could be this.push or this.hitForce or whatever you want to name it. You can see in the code snippet above that this.force is manipulated before applying it to the rigid body in an applyImpulse. Does this clarify this for you?

Yes I think I understand. It is like a local variable to the Vec3. Still new to JavaScript where you don’t have to declare a variable…


@jayypeak It’s OK. There are a lot of new people to javascript. I hope you continue to learn and make use of this forum. Yes your understanding is correct so no worries.