Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Toggleable Controls! Drag and Drop and Wheel to fly with the camera across your map! Also contains a mathematically perfect implementation of World2Screen! No magic numbers! We cracked it!
But first, check out the video reel!
The map provided is just for illustrative purposes, and for you to grab the triggers if you wish. Shoutout to Situ and the collaborators for the amazing MagicForest-Terrain template!
TODO: :: Allow for the Camera to be pushed
:: An out-of-the-box integrated WASD movement system! For the ultimate WoW feels!
:: Efficient raycasting for the Screen2World.
:: Your suggestions (maybe)
Hot as the sun. As soon as Bobby Kotick left the company, there's some real innovation happening.
I think to adopt it as a system for players (spectators) to setup the camera however you want after unlocking this with a command. Replacing the old -zoom and the newer UI-based menu someone made here.
I dabbled into this problem myself for an evening after finishing my mouse library. Since I wanted to reproduce exactly the WoW camera, which doesn't move while you're turning the camera, I spent most of the time trying to cage the mouse and still detect mouse movement. If you want to look at my solution, here. My solution works relatively well, but then it just goes completely nuts out of nowhere. Haven't figured out why, and, since you're working on this problem as well, I'm not gonna continue with it, so feel free to scavenge it for the mouse cage solution if you want to implement that as well.
Even when the Mouse event works, the raycasting is so shoddy on uneven terrain that the Camera gets inevitably bumpy.
:: :: - A great deal of smoothing was deployed, but perfect smoothness requires perfect terrain
That is because you're not accurately returning the terrain height. The GetLocationZ function does not return the height of the terrain geometry, which you want to get for determining the mouse position. The terrain geometry of each 128x128 tile is divided into two triangles, but the GetLocationZ function returns a curved plane. If you want a more accurate (and faster) result, you should use my GetTerrainZ function.
-- And so my third attempt began. To calculate a virtual camera in the most brass-tacks way that I know how.
-- A point, a plane, and lines firing from the world to the camera, burning a pixel on the screen exactly where they pierce the view plane.
-- A point, a plane, and lines firing from the world to the camera, burning a pixel on the screen exactly where they pierce the view plane.
-- A point, a plane, and lines firing from the world to the camera, burning a pixel on the screen exactly where they pierce the view plane.
Yes, the easiest approach, in my opinion, is thinking of the screen as a pinhole camera and calculating the point on the screen where a ray of light would hit from the mouse position. But an additional annoyance is that the y-coordinate of the point where perpendicular rays hit the screen appears to be changing with the angle of attack.
-- But in WC3, it's the other way around. A good way to prove this is to use the GUI action Rotate Camera Around Point.
-- You will see the camera rotating, but its Rotation field DOESN'T CHANGE!
-- Yes, it is as bad as you're thinking. That function is just changing both the camera position (in wc3, the Camera Eye) and the Cam Target.
-- Yes, it is emulating a rotation, WITHOUT USING THE ROTATION FIELDS!!!!!
-- This creates problems.
Ok, this is stupid, but is that such a big problem? Can't you adjust the camera with the rotation field instead of using that function?
-- And also Tangents, notoriously difficult to calculate, which we now know is done in wc3 by bluntly doing Sin(x)/Cos(x).
-- Yes, you read that right. It compounds the error in Sin(x) with the error in Cos(x) and then amplifies it with a division operation.
That would be true for the Tan native, but not for the Lua incorporated function, or not?
-- Something I need to clarify: these vector functions are all designed for immutability.
-- Meaning they spawn a new vector (a table, in lua) with each operation.
-- This is almost a crime, and any game that uses such strategy will probably get in trouble.
-- However, since the main purpose of this code is to showcase and conceptualize, it won't be a big problem.
Just don't use vectors. Does something like this really need to be its own function?
Lua:
local function Vec3Subtract(vecTo, vecFrom)
return {vecTo[1]-vecFrom[1], vecTo[2]-vecFrom[2], vecTo[3]-vecFrom[3]};
end
Just my personal pet peeve. I think all these mini functions make understanding someone else's code very difficult.
Lua:
local function AcosSafe(rad1)
return math.acos(Clamp(rad1,-1.0,1.0))
end
You can save the trigonometric function to local variables to make them faster, and you won't have to write math. everywhere.
-- this is interesting.
-- This function is creating the risen terrain on the map borders.
-- This is done because when the mouse is not over some terrain, WC3 won't tell me where the mouse is.
-- So, we rise the terrain's borders like a cradle, in the hopes of reducing the amount of times the raycasting fail.
You can modify the campaign maps to include any code you want, yes. It's not complex to paste a trigger into each of them, but it will take a bit of time/effort to change them all. I don't think you can add code to all maps in a campaign at once, but I could be wrong.
- Having to click control in the demo is extremely uncomfortable. So is being unable to right-click to move during the camera test.
- Would be informative if the demo map demonstrated how this camera system reacts to drastic height changes, something extremely common in WoW-like maps.
- Camera easing is visibly slow, what parameter controls it?
- WASD controls would be nice.
- Errors upon importing, re-assigning the target unit, and testing the map:
I agree that, while the tech behind this system is impressive, the specific implementation shown in the test map feels rather haphazard and needs some more work.
- Having to click control in the demo is extremely uncomfortable. So is being unable to right-click to move during the camera test.
- Would be informative if the demo map demonstrated how this camera system reacts to drastic height changes, something extremely common in WoW-like maps.
- Camera easing is visibly slow, what parameter controls it?
- WASD controls would be nice.
- Errors upon importing, re-assigning the target unit, and testing the map:
Thanks for the feedback!
- The camera controls are not inverted, they are responding to the dragging motion of the mouse. Thats the convention that most Apple/Adobe products use. But I agree that a checkbox could help in accomodating all users.
- There's a significant problem in WC3 regarding the mouse-wheel event, so "blocking" the clicks while controlling the camera was the only viable solution. That's also why there's a toggle to use the camera, so that you can switch between modes by just holding a key. I may have overstimated people's pinky strength, so I will add a hard-toggle to solve this issue.
- There are parameters in the code (identifiable by the _STRENGTH suffix) that control the magnitude of the camera controls
- WASD would be nice indeed, also a whole lotta work.
- Error is because your test map is in JASS. This is a Lua resource.
- There's a significant problem in WC3 regarding the mouse-wheel event, so "blocking" the clicks while controlling the camera was the only viable solution. That's also why there's a toggle to use the camera, so that you can switch between modes by just holding a key. I may have overstimated people's pinky strength, so I will add a hard-toggle to solve this issue.
- WASD would be nice indeed, also a whole lotta work.
- Error is because your test map is in JASS. This is a Lua resource.
Is it even feasible to expect a WoW-grade camera and controls system in wc3?
This drastically changes how I have to build the map, I was expecting your system to be the solution, but I understand that no one is a magician and can make things that cannot happen, happen.
What do I have to import/do to make this Lua system work?
Thank you for your efforts and your response, I know you wanted to release this for a long time.
Is it even feasible to expect a WoW-grade camera and controls system in wc3?
This drastically changes how I have to build the map, I was expecting your system to be the solution, but I understand that no one is a magician and can make things that cannot happen, happen.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.