Is it possible through any means, GUI, Code, Data Editor, or whatever, to detect when one model collides with the other, not when pathing collides, but when the physical models actually collide.
Specifically, no. You just need to pay very close attention to the radius data for units & other area selectors / validators when checking for collision. If you do it good enough, then no one is going to be able to tell the difference.
Well I don't think that would work so well for my purposes.
What I am trying to set up is third person aiming with mouse look, which means that you can aim above and below. But if the bullet passes overhead of a unit it would still register it as hitting, which is not good. :(
Aside from that I am also hoping to rig something up so that you can interact with objects by aiming and right-clicking on them, which that might work for.
--
Okay does anyone know what this is though: In the Data Editor, under actors, for the field Model Flags, there is an option called "Allow Hit Test". Does anyone know what that does?
Specifically, no. You just need to pay very close attention to the radius data for units other area selectors / validators when checking for collision. If you do it good enough, then no one is going to be able to tell the difference.
This doesn't work anyway when objects are moving at high speeds.
You need a traceline function to detect which units/buildings/terrain the player is aiming at using mouselook. Take the player's camera vaules: Yaw and Pitch. Use those angles to draw a line from the camera's height and position, along the direction the player is facing. Take small steps down the line in increments until it intersects a unit, building or terrain.
To detect collision with a unit, attach a region to the point in the traceline and get all units inside the region. If the unit count is >1, create a region with the radius of the unit (or your own custom value, which can be more accurate) and attach it to the unit. If the traceline intersects the region, you know that you hit the unit on the XY plane. To check the Z plane (height) you'll need to either specify a custom height for each unit (The most precise) or take the easy approach and just use the unit's radius as a baseline. Using the radius won't work very well on odd-shaped units like colossi or tanks. For flying units, you'll have to specify a Z offset as well. For instance, a muta flies 3.75 units above the c_heightMapAir heightmap.
Detecting collision with terrain is much easier. At each step, simply check if that point in the traceline is below the WorldHeight() at that point. If it is, then the shot collided with terrain and you can spawn the appropriate effects at that point.
This doesn't apply only to shooting. Any form of aiming will require a traceline. For instance, in Reaper Madness an enemy bar pops up when your crosshair is over another unit. This requires a traceline.
You need a traceline function to detect which units/buildings/terrain the player is aiming at using mouselook. Take the player's camera vaules: Yaw and Pitch. Use those angles to draw a line from the camera's height and position, along the direction the player is facing. Take small steps down the line in increments until it intersects a unit, building or terrain.
To detect collision with a unit, attach a region to the point in the traceline and get all units inside the region. If the unit count is >1, create a region with the radius of the unit (or your own custom value, which can be more accurate) and attach it to the unit. If the traceline intersects the region, you know that you hit the unit on the XY plane. To check the Z plane (height) you'll need to either specify a custom height for each unit (The most precise) or take the easy approach and just use the unit's radius as a baseline. Using the radius won't work very well on odd-shaped units like colossi or tanks. For flying units, you'll have to specify a Z offset as well. For instance, a muta flies 3.75 units above the c_heightMapAir heightmap.
Detecting collision with terrain is much easier. At each step, simply check if that point in the traceline is below the WorldHeight() at that point. If it is, then the shot collided with terrain and you can spawn the appropriate effects at that point.
This doesn't apply only to shooting. Any form of aiming will require a traceline. For instance, in Reaper Madness an enemy bar pops up when your crosshair is over another unit. This requires a traceline.
Yeah you're going to have to use something like a traceline; I haven't tinkered with that type of collision yet. There might be some way to find a Z value for the attachment point: head, but I couldn't get it to report a non-zero or non-error after a couple of mins.
Though you say you're making a third person shooter? Have you come up with a smooth camera? I was playing around with it some, and my camera ended up moving jerkily.
You need a traceline function to detect which units/buildings/terrain the player is aiming at using mouselook. Take the player's camera vaules: Yaw and Pitch. Use those angles to draw a line from the camera's height and position, along the direction the player is facing. Take small steps down the line in increments until it intersects a unit, building or terrain.
To detect collision with a unit, attach a region to the point in the traceline and get all units inside the region. If the unit count is >1, create a region with the radius of the unit (or your own custom value, which can be more accurate) and attach it to the unit. If the traceline intersects the region, you know that you hit the unit on the XY plane. To check the Z plane (height) you'll need to either specify a custom height for each unit (The most precise) or take the easy approach and just use the unit's radius as a baseline. Using the radius won't work very well on odd-shaped units like colossi or tanks. For flying units, you'll have to specify a Z offset as well. For instance, a muta flies 3.75 units above the c_heightMapAir heightmap.
Detecting collision with terrain is much easier. At each step, simply check if that point in the traceline is below the WorldHeight() at that point. If it is, then the shot collided with terrain and you can spawn the appropriate effects at that point.
This doesn't apply only to shooting. Any form of aiming will require a traceline. For instance, in Reaper Madness an enemy bar pops up when your crosshair is over another unit. This requires a traceline.
Great I was doubtful I would be able to do this. :D
One thing I don't quite understand is what do you mean by use the radius as a baseline?
Do you think you could give me a copy of Reaper Madness so I can take a look at how you set up that trigger? Or even just copy paste the trigger here.
Also, I watched your video of Reaper Madness, and the damage you were inflicting changed, was that an ability or have you worked out some kind of location damage?
Hmm attachment point Z, that would be very useful, you could even get location damage.
I just set up a camera and told it to follow the unit, it is pretty smooth except when you are zoomed in quite close, I am using a distance of 2, which waves a bit when walking but seems fine, anything closer gets jerky. In my experience.
It doesn't work any less than any other method. The lag just makes FPS games in general unplayable.
Why would lag from bnet make an fps unplayable? My ping to bnet is around 90-100ms.
Are you talking about processing time? Is your traceline function intensive? I'm interested in writing a traceline myself.
If you really need help doing a traceline function then I'm not sure if you're taking on the proper project. Nevertheless, I will post my results when I have them.
Is it possible through any means, GUI, Code, Data Editor, or whatever, to detect when one model collides with the other, not when pathing collides, but when the physical models actually collide.
@Ardnived:
Specifically, no. You just need to pay very close attention to the radius data for units & other area selectors / validators when checking for collision. If you do it good enough, then no one is going to be able to tell the difference.
Well I don't think that would work so well for my purposes.
What I am trying to set up is third person aiming with mouse look, which means that you can aim above and below. But if the bullet passes overhead of a unit it would still register it as hitting, which is not good. :(
Aside from that I am also hoping to rig something up so that you can interact with objects by aiming and right-clicking on them, which that might work for.
--
Okay does anyone know what this is though: In the Data Editor, under actors, for the field Model Flags, there is an option called "Allow Hit Test". Does anyone know what that does?
This doesn't work anyway when objects are moving at high speeds.
@Ardnived: Go
You need a traceline function to detect which units/buildings/terrain the player is aiming at using mouselook. Take the player's camera vaules: Yaw and Pitch. Use those angles to draw a line from the camera's height and position, along the direction the player is facing. Take small steps down the line in increments until it intersects a unit, building or terrain.
To detect collision with a unit, attach a region to the point in the traceline and get all units inside the region. If the unit count is >1, create a region with the radius of the unit (or your own custom value, which can be more accurate) and attach it to the unit. If the traceline intersects the region, you know that you hit the unit on the XY plane. To check the Z plane (height) you'll need to either specify a custom height for each unit (The most precise) or take the easy approach and just use the unit's radius as a baseline. Using the radius won't work very well on odd-shaped units like colossi or tanks. For flying units, you'll have to specify a Z offset as well. For instance, a muta flies 3.75 units above the c_heightMapAir heightmap.
Detecting collision with terrain is much easier. At each step, simply check if that point in the traceline is below the WorldHeight() at that point. If it is, then the shot collided with terrain and you can spawn the appropriate effects at that point.
This doesn't apply only to shooting. Any form of aiming will require a traceline. For instance, in Reaper Madness an enemy bar pops up when your crosshair is over another unit. This requires a traceline.
@rrowland: Go
I thought this doesn't work with bnet latency?
@Ardnived:
Yeah you're going to have to use something like a traceline; I haven't tinkered with that type of collision yet. There might be some way to find a Z value for the attachment point: head, but I couldn't get it to report a non-zero or non-error after a couple of mins.
Though you say you're making a third person shooter? Have you come up with a smooth camera? I was playing around with it some, and my camera ended up moving jerkily.
It doesn't work any less than any other method. The lag just makes FPS games in general unplayable.
@PSGMud: Go
My map is single player so it wouldn't matter, well at least for the time being, I am setting it up to allow me to add 2 player coop.
_ _ _
Great I was doubtful I would be able to do this. :D
One thing I don't quite understand is what do you mean by use the radius as a baseline?
Do you think you could give me a copy of Reaper Madness so I can take a look at how you set up that trigger? Or even just copy paste the trigger here.
Also, I watched your video of Reaper Madness, and the damage you were inflicting changed, was that an ability or have you worked out some kind of location damage?
_ _ _
@xenrathe: Go
Hmm attachment point Z, that would be very useful, you could even get location damage.
I just set up a camera and told it to follow the unit, it is pretty smooth except when you are zoomed in quite close, I am using a distance of 2, which waves a bit when walking but seems fine, anything closer gets jerky. In my experience.
Why would lag from bnet make an fps unplayable? My ping to bnet is around 90-100ms.
Are you talking about processing time? Is your traceline function intensive? I'm interested in writing a traceline myself.
If you really need help doing a traceline function then I'm not sure if you're taking on the proper project. Nevertheless, I will post my results when I have them.
I could probably work it out myself given a lot of time and effort, but it would be a hell of a lot easier to learn it from someone else's triggers.
In anycase I will always need help with a traceline function until I have actually tried it, wont I? :P
I've been trying to get the traceline to compile so i can attempt to use it but i cant figure out whats wrong.
it says implicit cast not allowed for this line lv_tracePoint = PointWithOffsetPolar(lp_cameraPosition, lv_traceDistance, lv_yaw);
and syntax error for this line lv_traceWorldHeight = WorldHeight(c_heightMapGround, lv_tracePoint);
i only know the very basics of programming in c+ but I don't see anything that would be giving me a syntax error..
If you need help with tracelines, rrowland made a tutorial about it.