Jump to content

How to implement weapon accuracy?


Recommended Posts

In a shooter game I can calculate the vector with direction that player look at. This vector can be used to guide the bullet. But in this case the weapon will have 100% accuracy. I want to add a random angle (within limited range) to this vector to simulate accuracy less than 100%. So, the question is how to get rotated vector in 3D space?

Link to comment
Share on other sites


hi use MAth : (Math.random()*1.-0.5)*0.1


    var pos = camera.position;

    var tar = {

    var r = new BABYLON.Ray( pos,tar,1000.);

    var meshFound = scene.pickWithRay(r );


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...