Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
3rd Person Shooter in CopperCube

dynamogames
Registered User
Quote
2023-02-18 05:58:10

I used 3rd Person Shooter in CopperCube for the Main Player Character in my game but I encountered some issues.
I used the default 3rd Person Camera that comes with CopperCube and smnmhmdy 3rd Person Camera.

For the default 3rd Person shooter, I encountered the following errors, (I'll provide the CCB file for further information):
-I can only move forward and backward, A and D key are used for rotating the camera so I can't target to shoot drones(enemies) in air(have higher vertical height than player) in the game.

- I cannot put collision around the player, when i put collision around the player, the player sinks in the terrain due to the effect of gravity and I cannot disable gravity in the game because player would automatically float in the air when player moves around terrain.

-Bullet(laser) can only come out of enemy drones when it has a camera parented to it, if I use the drone as it is without adding a camera as its parent, laser does not shoot. In the CCB file, this is exhibited in the red drone but does not work for the black drone.

- No Collision: If I put collision on camera as parent, it always goes through terrain and if I put collision on the drone, the drone still doesn't collide with terrain. In the CCB file, I put collision on both camera and drone (red drone) but still goes through terrain, I also tried putting "collide when moved" behavior for collision on drone and camera individually but still didn't work, drone still goes through terrain.
In CCB file, black drone has no camera as it's parent and collides with terrain. I think it is the effect of the camera parented to the red drone that doesn't make it collide with the terrain but black drone which isn't parented to camera cannot shoot lasers from the error I mentioned earlier so I can't use this method. If I do, the drone would have no camera parented to it (which is ok) and collides with terrain but can't shoot lasers.


dynamogames
Registered User
Quote
2023-02-18 06:10:20

Now for smnmhmdy 3rd Person Camera, I encountered the following errors:
-Since Main Player camera is not parented to the player, I can't target cross hair to shoot drones which are elevated above the player's height. This problem was also encountered in the default 3rd Person Camera that comes with CopperCube.
-When player walkSpeed and runSpeed is increased, I noticed that the gun which is attached to the player does not follow the player promptly and moves on its own without following the player. This can also be observed when the player moves sideways when "D" key is pressed, the gun doesn't follow the player adequately.

There are 2 scenes in the CCB file, in scene 1, the default CopperCube 3rd person camera is used but in Scene 2, smnmhmdy custom 3rd Person shooter is used.

Here is the CCB File:
https://drive.google.com/file/d/...


dynamogames
Registered User
Quote
2023-02-18 12:45:51

The drive link is now available. Sorry I forgot to change the settings to "Anyone can View".


billy
Guest
Quote
2023-02-20 13:54:28

Hi, I think I can help with the gun thing. I also noticed that the gun was not staying in the hands very well the 3rd person shooter camera.

What I did, is made a parent object which is actually being controlled and followed by the camera. The character model is attached to this parent controller, and the gun is attached to a joint node on the character model. Now, when the character jumps, etc, the gun does not lag behind. I hope this helps!


billy
Guest
Quote
2023-02-20 13:57:00

For aiming up and down with the 3rd person shooter camera, you can set the rotation of the character model to the camera's rotation. This will take a few lines of javascript code though


dynamogames
Registered User
Quote
2023-02-20 15:50:23

Thanks @billy but I don't really get your solution about the guns not staying in the players hands , can you pls upload the CCB file and send the link so I can check it out. Because I'm using the advanced 3rd person shooter by smnmhmdy and I'm not too sure I can attach any object to the camera as it might disrupt the 3rd person setup.

And for the aiming, do u know how to do this in JavaScript I'm not very conversant with JavaScript coding in CopperCube.


VP
Guest
Quote
2023-02-21 07:24:33

You could attach/child a sphere to the player (with zero polycount and zero scale) then attach an "on proximity" to the player - then set it to rectangle and make a long, thin box. Now position that proximity field forward of the player as an aim point. On proximity enter, set variable "air-target"= 1, on proximity leave, set variable "air-target"= 0. Now, before you shoot... If "Air-Target"=0, shoot (additional rotation 0,0,0). If "Air-Target"=1, shoot (additional rotation 0,1,0).

If there is a targer in the air, it will shoot angle up, if not, it will shoot straight. Just adjust the on-proximity box to suit your aim.


VP
Guest
Quote
2023-02-21 07:25:27

Just to clarify... set the on-proximity box to the sphere (childed to the player).


dynamogames
Registered User
Quote
2023-02-22 21:07:08

Thanks @VP for the suggestions but I want to please clarify some things.
For the sphere mesh, I attached it to the Player but there are other objects apart from the sphere that are attached to the player which are the gun, crosshair and the folder node which I used to attach the gun node to the animated joint (which is the hand of the player). My question is how do I rank the children of the player as I know this is important in CopperCube, should the folder node, gun and cross hair be children of the sphere or the sphere be a child of the folder node, gun and crosshair or the arrangement does not matter.

Then I added the "On Proximity" behaviour to the player, but I don't understand what you meant by positioning the "proximity field forward of the player as an aim point"
Do you mean I should place the sphere in front of the player as the players gun target?

Then for the "On Proximity" behavior, what should I put for the "near to what" field, is it the sphere mesh or something else?


VP
Guest
Quote
2023-02-23 07:36:54

It's simplest to just attach the dummy-sphere to the player node (not the animated joint) - and you don't need to child anything to it (eg, the gun), leave them all as they were before. The only reason for making a zero-poly and zero scale is to save on resources - in reality, you can use a transparent billboard or transparent mesh/plane/single-polygon etc (nothing special about it being a dummy-sphere - just light on resources/cpu and you are able to move it away from the player - to aim in the distance).

The Dummy-sphere will act as a simple target-selector/discriminator by using "on proximity" - so attach the on proximity events to the sphere and (while it's childed to the player, just drag it forwards into the distance and raise it up slightly so it can tell the difference between ground/air targets and wont aim at anything behind it).

Now just make the on-proximity detection-cube to a size that suits your aim-point.

I'll make a simple ccb file for you and upload it today. It's actually a lot simpler than it sounds.


VP
Guest
Quote
2023-02-23 09:55:25

Here's a link to a quick demo I made for you. If you want to use this method, let me know if I can help you any further with it...

https://veganpete.itch.io/reques...


dynamogames
Registered User
Quote
2023-03-01 17:31:25

Thanks so much @VP, I have been able to work it out.


VP
Guest
Quote
2023-03-01 19:37:49

You're welcome! glad you managed to get it working.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact