[Code] Chasecam

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

[Code] Chasecam

Post by The Zombie Killer »

This is a third person camera (compatible with most mods) that allows quite a few neat features, including angle-independent third person (the camera rotates, but the player doesn't).

Update (31/05/2016): Large update, now almost identical to built-in chasecam. Completely re-written
Update (04/10/2014): Camera no longer gets stuck on anything

Commands:
chase_active [1, 0] enables/disables third person view
chase_back [0, 30000] equivalent to chase_dist
chase_up [-1000, 1000] equivalent to chase_height
chase_type [0, 1]
  • 0: The player and camera will rotate (the default ZDoom chasecam)
  • 1: The camera will rotate, but the player won't
You do not have the required permissions to view the files attached to this post.
Last edited by The Zombie Killer on Tue May 31, 2016 2:46 am, edited 4 times in total.
User avatar
Nash
 
 
Posts: 17468
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [Code] Angle-Independent Third Person

Post by Nash »

Wow, really smooth! Finally no more 35 FPS bullshit! :D

One bug though: using ]kill monsters totally wrecks the script.

Also, I like how the camera doesn't get stuck anymore (I remember the old version you posted with the MLP player model, the camera always got stuck in that one) but it seems to be going through walls now. How about using hitscans to trace the camera positioning point? As far as I know, that's how ZDoom does it internally too... just fire a limited-range hitscan and position the camera at the end of the trace. If a solid object or wall is in the way, the view will "snap" to the collision point - again, exactly as how ZDoom is doing it. I'm using the same technique in my real-time weather engine to trace the sun from the player (to draw the lens flare on the screen). I also use this technique for the flashlight in my mod.

Use [wiki]LineAttack[/wiki] to fire hitscans directly in ACS.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Angle-Independent Third Person

Post by The Zombie Killer »

Nash wrote:One bug though: using ]kill monsters totally wrecks the script.
Fixed by adding "+NODAMAGE" to the "ChaseCam" actor
Nash wrote:How about using hitscans to trace the camera positioning point?
Funnily enough, that's exactly what I was planning to do for the next version, however there are some issues I've come up against when using LineAttack.
  • You cannot disable the bullet impact decal that LineAttack will place on a wall (afaik it uses the current decal defined by the player's current weapon)
  • You cannot define a TID for the puff (although there are workarounds for this)
EDIT: Here's the latest version, using LineAttack and with all the latest fixes and changes. Notice how it leaves decals everywhere.
New features:
  • Removed option to disable camera smoothing
  • Camera changes according to "chase_dist" and "chase_height"
  • Now uses LineAttack
  • Identical to the built in chasecam
  • Code cleaned up a little
You do not have the required permissions to view the files attached to this post.
User avatar
Nash
 
 
Posts: 17468
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [Code] Angle-Independent Third Person

Post by Nash »

I haven't downloaded it yet (I'm coding something ATM) but I wanted to pop in before I forget;

chase_rotateplr 2 will not behave as expected if the player is playing with a gamepad or joystick because BT_FORWARD/BACK does not register with them. You need to check for raw forward/backward input.
User avatar
Nash
 
 
Posts: 17468
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [Code] Angle-Independent Third Person

Post by Nash »

Ran through this real quick. Some issues:

- Camera gets stuck in front of monsters/solid objects. Try putting PUFFONACTORS? EDIT: actually upon checking with ZDoom, it seems the camera trace completely ignores monsters and goes right through them. +THRUACTORS would help maybe
- Turning is very stuttery... even worse than the 35 FPS behaviour (which is a different thing). Can anything be done about this?
- And then of course the decals... I made a feature suggestion. If that gets no'd, then I'm sure there are some other workarounds/hacks.

EDIT: For reference, here's the DECORATE for my sun hitscan. One of these flags ought to work

Code: Select all

Actor Z_SunScannerPuff : BulletPuff
{
    // Any visual-related props/flags are for testing purposes only
    Radius 4
    Height 8
    RenderStyle None
    Alpha 1.0
    VSpeed 0
    Mass 0x7FFFFFFF
    Scale 4.0
    +NOGRAVITY
    +NODAMAGETHRUST
    +PUFFONACTORS
    +PUFFGETSOWNER
    +ALWAYSPUFF
    +BLOODLESSIMPACT
    +DONTSPLASH
    +NOTIMEFREEZE
    +SOLID
    +FORCEXYBILLBOARD
    -ALLOWPARTICLES
    -RANDOMIZE
    States
    {
        Spawn:
            TNT1 A 1
            Stop
        Crash:
            TNT1 A 1 Thing_ChangeTID(0, ACS_NamedExecuteWithResult("Script_GetSunScannerTID", 0))
            BON1 A 1 Bright ACS_NamedExecuteAlways("Script_DrawSunGlareFlat", 0)
            TNT1 A 1
            Stop
    }
}
User avatar
IMX
Posts: 791
Joined: Sat May 11, 2013 9:20 am
Location: Frogland, Mexico

Re: [Code] Angle-Independent Third Person

Post by IMX »

Bookmarked topic successfully.
User avatar
Hornetzero
Posts: 312
Joined: Wed Dec 05, 2012 12:42 am
Location: Twighlight zone

Re: [Code] Angle-Independent Third Person

Post by Hornetzero »

two things about this.

1, Would it allow for a given set of sprites representing the topdown view ala RTS perspective? Like instead of getting flatter as the camera moves straight on top of the player, it instead changes to an RTS/Topdown perspective sprite?

2, When I have the camera face the player from the front, and than press the fire key, he turns his back and shoots the opposite direction. Was this intended? If its a free view, it shouldn't interfere with the player's direction.
User avatar
Nash
 
 
Posts: 17468
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [Code] Angle-Independent Third Person

Post by Nash »

Regarding (2), in Skyrim that's kind of how it behaves (in attack mode, the camera will always go behind the player so you can't "shoot the screen" so to speak)... but in the GTA games, I believe you can shoot the screen... anyway, it's just a matter of removing the fire button check from the relevant part of the code so it's easy to custom tailor it for your project's needs.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Angle-Independent Third Person

Post by The Zombie Killer »

Sorry for the slight inactivity on my part in this thread, so to make up for it, have a new version!
  • Doesn't get stuck on actors
  • Camera faces player when spawned now
  • Player won't rotate when dead
  • chase_height can be ignored with a cvar (chase_enableheight) at the moment, because it is imperfect at this time
  • New player rotation setting "3", identical to 2, but won't rotate the camera if you are only firing
UltimateThirdPerson.pk3
Hornetzero wrote:1, Would it allow for a given set of sprites representing the topdown view ala RTS perspective? Like instead of getting flatter as the camera moves straight on top of the player, it instead changes to an RTS/Topdown perspective sprite?
So do you mean having rotation sprites for the top and bottom of the player, in addition to the sideways rotations? If so, then yes, this should be possible, but it'd require a few hacks.
Hornetzero wrote:2, When I have the camera face the player from the front, and than press the fire key, he turns his back and shoots the opposite direction. Was this intended? If its a free view, it shouldn't interfere with the player's direction.
Pretty much what Nash said. I've added a third camera rotation setting that won't rotate when firing now.
Nash wrote:Camera gets stuck in front of monsters/solid objects.
I did notice this myself, +PUFFONACTORS fixes the whole stuck part, and I tried +THRUACTORS before but it didn't seem to make a difference :\
Nash wrote:Turning is very stuttery... even worse than the 35 FPS behaviour (which is a different thing). Can anything be done about this?
Sadly I don't think I'll be able to fix this, at least, I can't think of a way yet.
Nash wrote:And then of course the decals... I made a feature suggestion. If that gets no'd, then I'm sure there are some other workarounds/hacks.
Took a look at your suggestion, I reckon a better method would be some flags for bulletpuffs though
+NODECALS - Disables impact decals for puff
+FORCEDECAL - Forces the puff to use its defined decal, instead of being overridden by the decal defined in the player's current weapon
You do not have the required permissions to view the files attached to this post.
User avatar
Nash
 
 
Posts: 17468
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [Code] Angle-Independent Third Person

Post by Nash »

The Zombie Killer wrote:So do you mean having rotation sprites for the top and bottom of the player, in addition to the sideways rotations? If so, then yes, this should be possible, but it'd require a few hacks.
Kind of out of scope of this library in my opinion, has the risk of making the codebase overly complicated and unclean. Plus it will never work right in multiplayer (if you alter a sprite for one player, other players will see it too and it would just look wrong).
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Angle-Independent Third Person

Post by The Zombie Killer »

Oh of course, I don't intend to program such a thing, let alone attach it to this library :p. I was merely stating its possibility.
User avatar
Nash
 
 
Posts: 17468
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: [Code] Angle-Independent Third Person

Post by Nash »

All in all, this is good stuff and I definitely see myself using the library (with your permission of course!)... as soon as you figure out ways to combat the jittery rotation and the decal thing. I'm sure you'll pull through.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Angle-Independent Third Person

Post by The Zombie Killer »

Nash wrote:I definitely see myself using the library (with your permission of course!)
You don't even need that :p
The rule I have with everything I produce (ZDoom-wise) is that it's 100% free to use without permission or credit, unless I explicitly specify otherwise
User avatar
jazzmaster9
Posts: 867
Joined: Wed Apr 18, 2012 11:37 pm

Re: [Code] Angle-Independent Third Person

Post by jazzmaster9 »

There seems to be a glitch with the camera, it's making decals on the wall.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Angle-Independent Third Person

Post by The Zombie Killer »

jazzmaster9 wrote:There seems to be a glitch with the camera, it's making decals on the wall.
Someone didn't read the thread before posting :p

Return to “Script Library”