Thứ Tư, 31 tháng 10, 2018

Auto news on Youtube Oct 31 2018

Halloween is upon us gentlemen and ladies.

It is a spooky time of year and it is only right that even a game dev related channel

partakes in the festivities.

Now my original plan was to have CryEngine, Xenko and Unity projects built for the project

in mind today but sadly, I just was not able to complete the work and testing in time.

I do however, have one complete and ready to go with one caveat…

Tank controls are not properly implemented.

If that hasn't given away the topic today, then the video that has been playing of Resident

Evil 1 and Resident Evil 0 remasters for PC should have.

Yes folks, today, we will be implementing the static cameras as seen in the classic

Resident Evil or Biohazard games.

(intro) I already have Unity opened up so we can begin

this adventure, but first, there is a bit of setup I'm going to do prior to setting

up the camera in Unity.

So, here is a nice track from The Omnific to keep you entertained while I speed up this

part.

(omnific song) Alright, the level design is complete.

The first thing we will do is set our camera and create two more while placing them in

the position we want them to be in.

We also want to follow the convention I set forth by creating an empty game object at

the Vector position of zero.

The position is purely based on my own OCD about making the parent object be in the center.

Drag and drop all three cameras into the Camera Parent Object.

Be sure to rename the cameras as Cam1, Cam2 and Cam3 respectively.

Now, we will create a code folder and make 2 scripts.

The first script is CameraTrigger which will be used to trigger our camera to switch from

one to the next.

The second script is Player Movement.

This script will be used to move the player character.

Following this, we need to make sure we add box colliders to all of the walls that were

created.

It should be obvious as to why, but the reason we are adding colliders is to make collisions

possible.

Without them, you could phase through the wall during gameplay.

Next on the list is to create a sphere which will act as the player character.

We don't have to worry about adding a sphere collider because Unity does this by default

for us with the basic 3D Objects.

What we do need to worry about is setting the proper position.

The next item to complete is to create two boxes.

I will be changing their size and height to cover a larger area.

The reason for this is to make sure the player will trigger the collisions.

I will also set the collision type to be a trigger.

The reason for this is to ensure that the player does not collide with the object and

instead will activate an event.

Make sure to name the trigger objects to be Trigger1 and Trigger2.

Finally, I will create another empty game object with the name Triggers and drag the

two trigger objects into it.

Again this is for organizational reasons.

I'm going to stop the design from here and move into the code section.

This will allow us to have

the code completed and make the final touches in the editor.

(Code Transition) The first script we will complete is the CameraTrigger

script.

Since we know that this code will allow us to switch between cameras at runtime, we have

a basic idea of what needs to be done.

We could enable and disable the gameobjects at runtime or we could enable and disable

the camera components at runtime.

The first thing to do is to create a public List of type Camera and call it cameras.

This will be used to store all of our camera objects.

Next up is to create a public string called cam name.

This will be used to specify which camera we want active at the given time.

Create a private void On Trigger Enter method that takes a Collider as the parameter.

We don't want collision Enter because that would create a collision event instead of

a trigger event.

Inside, create a for loop.

For int I is set to 0.

I is less than cameras dot capacity.

I plus plus.

We are looping through the list of cameras we specify in the editor which will give it

a non null value.

Create an if statement inside of the for loop.

If cameras square bracket I, closing square bracket dot name is equal to cam name.

We have to remember that we are iterating through a list of objects which is why we

have the square brackets around cameras.

Cameras square bracket I, closing square bracket dot enabled is set to true.

Outside of the if statement, create an else statement.

Cameras square bracket I, closing square bracket dot enabled is set to false.

This basically says that if the camera's name from within the list is not the same

as the string value of cam name, then that camera is disabled.

If it is the same, enable it.

This completes our Camera Trigger script and we can move on to the player movement class.

The first thing we will do is write public float speed.

This will set the speed of our model in game from the editor.

Now we will create a movement method.

Inside will have several different if statements.

If Input dot getkey, keycode w.

Inside we will write transform dot translate plus equals vector three dot forward multiplied by time

dot delta time multiplied by speed.

This will normalize the speed of which the player moves on the forward vector while giving

a speed multiplier.

If Input dot getkey, keycode s.

Inside we will write transform dot translate plus equals vector three dot back multiplied by time dot

delta time multiplied by speed.

If Input dot getkey, keycode a.

Inside we will write transform dot translate plus equals vector three dot left multiplied by time dot

delta time multiplied by speed.

The final if statement is, if Input dot getkey, keycode d.

Inside we will write transform dot translate plus equals vector three dot right multiplied by time

dot delta time multiplied by speed.

Lastly, create an Update method.

Inside of it write Movement.

This will allow for the movement script to actually run and update with the game.

Whew, the code section is now done.

So we can go back to the editor and finish where we left off.

(Editor Transition) Go back to the Sphere and add a rigid body

component to it and the movement script.

The reason for the rigid body is to enable 3D physics to allow for collisions to actually

take place and have gravity enabled.

To allow for movement, the movement script does this.

Set the value of speed to be 10, you can go lower or higher if you want, but I find 10

to be the better number.

This should give a fairly decent move speed although just remember that the slower the

speed, the scarier you can make the game, in some cases.

Click on the First trigger we created and add the Camera Trigger Script onto it.

Expand the Cameras list and add the number 3 to the size.

This will set the list to have a value of 3 cameras.

Add all three cameras to this list.

The string value of Cam Name should be set to Cam2 for the first trigger and on the second

trigger, the Cam Name should be Cam3.

Finally, uncheck the Mesh Renderer from the two Trigger Objects.

This is so that it will not render the object but the collision detection is still enabled.

Click the play button and you will see that we have static cameras enabled but just remember

that we did not write the code for controls not based on camera position, so some controls

will be reversed at times.

So here's my challenge for you guys, rewrite the movement code to be proper tank controls

or movement not based on camera position.

If the player presses the forward button, the model should always move in the forward

direction.

I want to give a warm shout out to my patreon supporters and to everyone in my discord server

that gives me ideas and criticism on my videos.

I also want to thank all of you that watch my content.

And now, an ad about NordVPN.

Do you live in a country where certain websites are blocked?

Do you live in the EU and are in fear of Articles 11 and 13?

Do you just want to protect yourself online?

Get NordVPN, choose which servers you want to connect to and use it on PC, MacOS, Linux,

iOS and Android all for the low low price of $3.99 US per month.

They accept Paypal, Visa, Mastercard, Amex and Discover credit cards, they accept crypto

currencies as well.

Bit Coin, LTC, Dash, Etherium, XMR, ZEC, and XRP.

Finally, if you don't have access to any of these, they also accept Alipay, UnionPay,

and Mint.

I use this software and if you need a VPN, you should too.

Link is in the description box below.

For more infomation >> Classic Resident Evil Cameras in Unity #Halloween - Duration: 12:59.

-------------------------------------------

Roller Coaster Tycoon Classic Unlocked (+Download) | RCT Classic APK+MOD (updated version) - Duration: 3:08.

In this Video I'll show you how to install RollerCoaster Tycoon Classic for free with all game extensions.

First click on the link in the Video description or on the Link in the pinned comment!

Then Download this file. All files needed are included in this Zip file.

Now wait for the Download to finish.

After Downloading you will need ZArchiver or any other File manager of your choice to extract all files from the Zip File.

Go to your Downloads Folder and extract the Zip File.

Now copy the com.atari.mobile.rctc (this is the obb) to Android>obb Folder.

Now install the APK.

Now you can just open it!

Thanks for watching. Please Like and Subscribe!

Không có nhận xét nào:

Đăng nhận xét