Jump to content

Pick() how to use it ?


YouGroove
 Share

Recommended Posts

Are you kidding ? I have declared a character controller, why should i use a a trick and do more work ?

Is not character controller a physic object with collision already, that pick should always detect in any case , like Unity raycast and character physic capsule volumes.

 

There is a bug with Pick , the raycast should detect the character controller physic cylinder between two 3D points at any time (without adding any physic shapes or any tricks).

 

I dunno, pick does have issues with the character controller

OS: Windows 7

Processor: AMD A6-3420M APU integrated Radeon HD Graphics 1.50 GHz

Link to comment
Share on other sites

but it seems it is not even hitting the mesh of the character-controller model. So something must be wrong there?

 

same thing happens with aggror's turret if you don't have a box over the character, and set a pivot for it to look at the character chest to shoot at (if not it shoots at the player's origin at the feet)

OS: Windows 7

Processor: AMD A6-3420M APU integrated Radeon HD Graphics 1.50 GHz

Link to comment
Share on other sites

I believe picks are done on the mesh not the physics object.

What says the docs on that ? I seen that you can specify the collision type like Collision.Character, so pick works on physic volumes (and bones it seems what is strange laugh.png )

I just see it working but stop working on some cases turning around the mob using GotoPoint().

Stop toying and make games

Link to comment
Share on other sites

I made many new tests also.

 

When the mob is using navigation and just running forward on your direction, Pick() always work.

When the mob is chasing you , if you change direction , the mob is no more aligned on your direction and the Pick don't work.

The mob needs to face the player to be able to have Pick work.

 

There is a serious bug about Pick, i think it takes account of the direction, not only the two 3D points, what is weird if you read the docs and function parameters.

 

I will ask Josh to create a new function working in any case a real raycast one using two 3D points.

 

We will name it : RaycastBetweenAandB laugh.png

 

 

No it doesn't. You are going to make me find that post aren't you *sigh*

The doc is imprecise about Pick, not complete, this is what you mean ?

Seeing we can declare the type of physics in Pick(), it means for me it works with physic volumes not mesh polygons.

Stop toying and make games

Link to comment
Share on other sites

Check the script I updated in post #26. Works fine in there.

 

It works , but you changed many things :

- you changed the speed of the mob movement

- you changed GotoPoint() to Follow()

- you change position of center models for Pick() call :

if (world:Pick(posMob+Vec3(0,1.2,0), posPlayer+Vec3(0,1.6,0), pi, 0, true)) == false then
return 0
end

 

 

I avoid Follow because with faster mob movement , it behaves like a car, having acceleration and not able to stop immediatly if the player moves near it , to it continues the trajectory and turns around like a car

But i'll make more tests and perhaps do physic tricks to stop it directly (physicsSetPosition for example) and use Follow perhaps.

Thanks a lot Jazzonya for the script smile.png

 

There is a problem with physic character using GotoPoint() calling Pick() , a bug , let's not hide it under the carpet and get it fixed perhaps.

Stop toying and make games

Link to comment
Share on other sites

Another good bug now using Follow()

 

If i use these Y values that are good as debug spheres are above the floor, the Pick() don't work all time , and becomes as bugged when the mob is using GotoPoint()

 

posPlayer.y = posPlayer.y +1
posMob.y = posMob.y +2.1

 

follow_Bug.jpg

 

I don't understand changing Y values that are valid with spheres debug above the floor , makes it no more working good with Follow() ?

 

Pick() with GotoPoint() and Follow() is definitively bugged for some cases.

Stop toying and make games

Link to comment
Share on other sites

Another test : Pick() just never work with these Y values for start and end points of raycast ?

It never works could the mob use Follow() or just stay in front of the player.

 

 

local posPlayer = self.target:GetPosition()
local posMob = self.entity:GetPosition()

posPlayer.y = posPlayer.y + 2
posMob.y = posMob.y +2.1 

 

 

 

follow_Bug3.jpg

 

While these Y values works perfectly ?


posPlayer.y = posPlayer.y + 1.5
posMob.y = posMob.y +2.1

 

 

A raycast between two 3D points when there is no obstacle should always work whatever are the Y values.

 

 

I can make some game choosing good Y values, but having these bugs is not so good and it could lead to more problems in other cases of gameplay using Pick() like lasers detection, static roof or walls AI detection etc ...

Stop toying and make games

Link to comment
Share on other sites

Has it been some changes with Pick() in last update ? it seems worst ?

pick.jpg

 

function Script:RaycastPlayer2()
 self.entity:SetPickMode(1)

 local posPlayer = self.target:GetPosition()
 local posMob = self.entity:GetPosition()
 posPlayer.y = posPlayer.y +1.6
 posMob.y = posMob.y +1.6 

 self.debugSphere3:SetPosition(posPlayer)
 self.debugSphere:SetPosition(posMob)

 local world = World:GetCurrent()
 local pi = PickInfo()
 if (world:Pick(posMob , posPlayer , pi, 0, true)) == false then 
  return 0 
  end
 -- did we hit our target?
 if pi.entity == self.target then
  return 1  
 end 

 -- we hit something else
 return 2

end

Stop toying and make games

Link to comment
Share on other sites

I'm not so stupid, this the working example shadmar used also, it has spheres already are in PickMode(0) from beginning of tests.

 

 self.debugSphere = Model:Sphere()
self.debugSphere:SetColor(1.0,0.0,0.0)
self.debugSphere:SetPickMode(0)
self.debugSphere:SetCollisionType(0)
--self.debugSphere:SetPhysicsMode(Entity.RigidBodyPhysics)

self.debugSphere3 = Model:Sphere()
self.debugSphere3:SetColor(0,0.0,1.0)
self.debugSphere3:SetPickMode(0)
self.debugSphere3:SetCollisionType(0)

 

I already posted test levels for anyone to test.

 

There is bugs and serious ones.

Stop toying and make games

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.

Guest
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.

 Share

×
×
  • Create New...