![]() |
#1 | |
User
Join Date: Mar 2008
Posts: 205
![]() ![]() |
![]() OppiCam 1.2d
OppiCam is a camera system designed especially for RPGs but can very well be used on any other map. This version currently consists of two main vJass libraries, each containing a proper camera system. The system also contains two optional plugin libraries that add keyboard control to the cameras. For these plugins to work Anitarf's ArrowKeys is required which is also included in this map. Library ThirdPersonCam: Tutorial: How to set up OppiCam if you don't know jack about Jass For some reason this system is attracting a lot of GUI users who really want to use this system but don't know anything or just very few about (v)Jass. The following tutorial is intended to help these people setting up an OppiCam in their map. 1. Meeting the requirements Last edited by Opossum : 07-19-2010 at 04:10 PM. |
|
![]() |
![]() |
Sponsored Links - Login to hide this ad! |
|
![]() |
#2 |
User
Join Date: Sep 2006
Posts: 687
![]() ![]() |
![]() Post the trigger.
|
![]() |
![]() |
![]() |
#3 |
User
Join Date: Nov 2006
Posts: 199
![]() ![]() ![]() |
![]() Hmm. Very nice. I really liked this camera, especially being able to change the angle of attack so fluidly. The fixed camera is also pretty cool, it really did remind me of RE. Nice work.
It behaves a little strangely near cliffs. I was able to get the camera to continuously try to give me view of my footman. The white box on the minimap was constantly resizing and it caused my camera to sort of rotate around until I moved him away from the cliff. Granted, I had to really try to get the camera to bug out a little. |
![]() |
![]() |
![]() |
#4 |
Yay!
Join Date: May 2006
Posts: 870
![]() |
![]() This is incredible. I just tried both cameras recently and I find it very fluid and non-chunky like. Even tho as Veev said it is buggable (to an extent), it's still very rare in a normal game. +rep for awesome system
__________________ |
![]() |
![]() |
![]() |
#5 |
MaD Da ViNci
Respected User
Join Date: Apr 2003
Posts: 1,699
![]() ![]() ![]() ![]() |
![]() very nice system, havent tried it but is it possible to make it rotate to the footman's facing angle slower? tat would be awesome. (or not rotate at all)
__________________ |
![]() |
![]() |
![]() |
#6 | |
default string
|
![]() Quote:
If you want to make it not rotate at all you'll have to modify the system yourself (as I have done) because Oppi hates it not rotating/panning so he didn't include that option into the system. Although I think he should. Either comment out the lines call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(Unit[p]) + ControlableRot[p], PAN_DURATION) for rotation and call PanCameraToTimed(panx, pany, PAN_DURATION) for panning. The other option is to add a boolean array check for each player so that they can turn it on/off whenever they want to (which is what I do). Last edited by Fledermaus : 03-01-2009 at 09:51 AM. |
|
![]() |
![]() |
![]() |
#7 | ||||
User
Join Date: Mar 2008
Posts: 205
![]() ![]() |
![]() Weee first: thanks for the positive feedback :)
Quote:
Edit: Added the ThirdPersonCam code. Strangely I can only post one of the libraries. Is there any character limit for posts? Quote:
Quote:
Quote:
Last edited by Opossum : 03-01-2009 at 05:27 PM. |
||||
![]() |
![]() |
![]() |
#8 |
User
Join Date: Nov 2006
Posts: 199
![]() ![]() ![]() |
![]() Yes, by "sort of rotate around" it was moving around my hero in a circular fashion, trying to find him. But, like I said, the camera was only doing that because I was trying pretty hard to bug it out.
|
![]() |
![]() |
![]() |
#9 |
User
Join Date: Jan 2007
Posts: 528
![]() ![]() |
![]() It's nice but it doesn't work for flying units about a cliff (I changed the subject to an Orc Wind Rider).
|
![]() |
![]() |
![]() |
#10 | |
User
Join Date: Mar 2008
Posts: 205
![]() ![]() |
![]() Quote:
I just tried a gryphon rider and it worked fine. Ok Blizzard's flying height smoothing causes GetUnitFlyHeight to not always return the correct flying height but that can easily be solved by adding 'Arav' to the unit. Although adding that to the system would limitate the user quite a bit imo so I left it out. |
|
![]() |
![]() |
![]() |
#11 |
User
Join Date: Jan 2007
Posts: 528
![]() ![]() |
![]() ya the smoothing
just thought id inform you so you can ameliorate it if you wanted |
![]() |
![]() |
![]() |
#12 |
User
Join Date: Mar 2008
Posts: 205
![]() ![]() |
![]() Updated the map and main post.
Somebody should've told me about text macros a long time ago. <3 them :) |
![]() |
![]() |
![]() |
#13 |
Procrastination Incarnate
Development Director
|
![]() I have only looked at the third person camera code so far. My thoughts:
__________________You have a lot of unneeded function calls, functions which you only call once and could easily inline, getting rid of code bloat such as the loc struct. You could argue that the functions are there to help organize the code and make it more readable but since your code is entirely uncommented you can hardly use readability as an argument. GetHighestPointInLine isn't really what you need here. You need the highest angle of attack, a lower point that's closer to the unit could get more in the way of the camera than a slightly higher point that's further away. I disagree with the hardcoded reset command, especially because it uses the clumsy and ugly chat messages. Instead you should provide a public function for resetting the orientation and let the user decide how and when to run it with external code. In fact, you could do the same for all camera controls, moving all the arrow keys code to an optional module. I think it would be better if you only interpolated values between OFFSET_AOA_1 and 2, while if the angle is greater than OFFSET_AOA_1 the offset would simply get capped at OFFSET_OFFSET_1. That way you would also no longer need the OFFSET_LIMIT constant. The code isn't quite streamlined yet, I already mentioned the unneeded function calls, then there's some unneeded local variables etc. You could further reduce the code bloat by using some external libraries such as ArrowKeys. Edit: I was reminded of a function for getting a precise camera z offset that Toadcop posted in this thread. I see you use a different method, I haven't been able to test how it works yet so I don't know if either of the two methods is better than the other, I just thought I'd link to it for your consideration. I notice you smooth out your camera movement anyway while that function was designed to get an instant camera lock so it might not apply. |
![]() |
![]() |
![]() |
#14 | |||||
User
Join Date: Mar 2008
Posts: 205
![]() ![]() |
![]() Quote:
GetCameraField(CAMERA_FIELD_ZOFFSET) - ((GetCameraTargetPositionZ() - GetLocationZ(Loc)) - (Z_OFFSET + GetUnitFlyHeight(Unit[p]))) First I get (GetCameraTargetPositionZ() - GetLocationZ(Loc) This returns the actual difference between the camera target's z (that includes the camera's smoothened z-offset) and the terrain height of the target location. So basically what this returns is the camera's real z offset. Let's call this RealZ. Then I get the difference between RealZ and the actual z offset I want: RealZ - (Z_OFFSET + GetUnitFlyHeight(Unit[p])) (let's set the flying height to 0 to simplify it a bit). Let's call this value "TooHigh" If this value is positive then the camera is actually too high meaning I have to reduce the current "non-real" but controlable z offset by this difference. GetCameraField(CAMERA_FIELD_ZOFFSET) - TooHigh That's it... not that complicated imo. Quote:
Quote:
Quote:
Quote:
Edit: Ok I just noticed unitx, unity, panx, pany are actually not absolutely necessary. I'll watch out more for stuff like that. Anyway: thanks for having a look at it :). Last edited by Opossum : 03-03-2009 at 06:18 PM. |
|||||
![]() |
![]() |
![]() |
#15 |
User
Join Date: Feb 2009
Posts: 203
![]() ![]() |
![]() Toadcops CamZ function just brakes Blizzards stupid camera smoothning, so you can get more accurate Z heigths.
__________________It has caused some weird bugs to me, but you should maybe test it and see if it is better for you. ![]() public function CamZ takes real z returns nothing set z=GetCameraField(CAMERA_FIELD_ZOFFSET)+z-GetCameraTargetPositionZ() call SetCameraField(CAMERA_FIELD_ZOFFSET,z,-0.01) call SetCameraField(CAMERA_FIELD_ZOFFSET,z,0.01) endfunction Anyways, this system is awesome. Nice work. ![]() Last edited by Viikuna- : 03-03-2009 at 09:13 PM. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
|