Raycast API changes.
This commit is contained in:
@@ -114,7 +114,7 @@ namespace Content.Server.AI
|
|||||||
var ray = new Ray(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.MobImpassable | CollisionGroup.Impassable));
|
var ray = new Ray(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.MobImpassable | CollisionGroup.Impassable));
|
||||||
|
|
||||||
// cast the ray
|
// cast the ray
|
||||||
var result = _physMan.IntersectRay(ray, maxRayLen);
|
var result = _physMan.IntersectRay(myTransform.MapID, ray, maxRayLen, SelfEntity);
|
||||||
|
|
||||||
// add to visible list
|
// add to visible list
|
||||||
if (result.HitEntity == entity)
|
if (result.HitEntity == entity)
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace Content.Server.AI
|
|||||||
{
|
{
|
||||||
var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1).Normalized;
|
var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1).Normalized;
|
||||||
var ray = new Ray(entWorldPos, dir, (int) CollisionGroup.Impassable);
|
var ray = new Ray(entWorldPos, dir, (int) CollisionGroup.Impassable);
|
||||||
var rayResult = _physMan.IntersectRay(ray, MaxWalkDistance, SelfEntity);
|
var rayResult = _physMan.IntersectRay(SelfEntity.Transform.MapID, ray, MaxWalkDistance, SelfEntity);
|
||||||
|
|
||||||
if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object
|
if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,10 +129,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
|
|
||||||
var resSet = new HashSet<IEntity>();
|
var resSet = new HashSet<IEntity>();
|
||||||
|
|
||||||
|
var mapId = Owner.Transform.MapID;
|
||||||
for (var i = 0; i < increments; i++)
|
for (var i = 0; i < increments; i++)
|
||||||
{
|
{
|
||||||
var castAngle = new Angle(baseAngle + increment * i);
|
var castAngle = new Angle(baseAngle + increment * i);
|
||||||
var res = _physicsManager.IntersectRay(new Ray(position, castAngle.ToVec(), 19), _range, ignore);
|
var res = _physicsManager.IntersectRay(mapId, new Ray(position, castAngle.ToVec(), 19), _range, ignore);
|
||||||
if (res.HitEntity != null)
|
if (res.HitEntity != null)
|
||||||
{
|
{
|
||||||
resSet.Add(res.HitEntity);
|
resSet.Add(res.HitEntity);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
|||||||
var angle = new Angle(clickLocation.Position - userPosition);
|
var angle = new Angle(clickLocation.Position - userPosition);
|
||||||
|
|
||||||
var ray = new Ray(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
var ray = new Ray(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
||||||
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(ray, MaxLength, user);
|
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(user.Transform.MapID, ray, MaxLength, user);
|
||||||
|
|
||||||
Hit(rayCastResults, energyModifier);
|
Hit(rayCastResults, energyModifier);
|
||||||
AfterEffects(user, rayCastResults, angle, energyModifier);
|
AfterEffects(user, rayCastResults, angle, energyModifier);
|
||||||
|
|||||||
Reference in New Issue
Block a user