Raycasthit2d

broken image



How is Everhood going

How to make from RayCastHit2D grappling gun / hook in 3 steps? Unity Engine tutorial under 1 minute. Code - https://gist.github.com/FilipCizek/e79f9e0ed07fc. Emmy-award winning Cinemachine is a suite of tools for dynamic, smart, codeless cameras that let the best shots emerge based on scene composition and interaction, allowing you to tune, iterate, experiment and create camera behaviors in real-time.

We are doing very good progress on Everhood! Chris is creating more and more in-game content, no one can stop him! From my side (Jordi), I have been working on fixing and creating new in-game logic, don't want to do spoilers but, I bet you will be amazed :D

As I mentioned in Game Localization devlog, trying to not spoil the story and the in-game content is one of our main goals. Here's all we can say for the moment.
To compensate I've made a second mini tutorial/tip for unity c#, you can check the first tutorial/tip here.


Lets create a simple 2D laser! - Unity C#

Difficulty: Beginner

Lasers...who doesn't like lasers?

As I love both lasers and each of you, well, let's create the laser logic step by step!

First, let's create a new empty game object and assign a LineRenderer component to it.


Next, make sure to assign the Sprites-default material and set the alignment to 'Transform Z'


Then, create a new script called Laser and open it.

Now let's get the line renderer component at Start().


Next, we need to know when an object collides with the laser, let's use Raycast!


Finally, we need to set line renderer position according to the raycast. Keep in mind that the line renderer have two points 0 and 1, so we need to set both the start point and the end point.

The start point is going to be the main transform position,

The end point is going to be the raycast hit point position,

If the raycast don't hit something, just set the end point to an infinite or large value.


Assign Laser script to the empty game object we just created, set editor to play mode et voila!


I hope this mini tutorial was useful!

// Jordi

Raycasthit2d Example


Unity

Physics2d Raycast

Wishlist us here so you don't miss any news:





broken image