Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Franck on September 21, 2018, 01:39:54 PM
-
Hello everyone,
I'm trying to create a bullet hole with a raycast hit.
I have a state in which the "raycast" action that creates the raycast and stores the informations.
In the following state I have a "create object" action that contains my "bullet hole" object and gets the position of hit raycast ("hit point") and rotation ("hit normal").
But when I pull the raycast my bullet holes are positioned correctly on vertical walls but not on floors.
The bullet holes still remains positioned vertically.
Have I forgotten something?
-
Hi.
What action do you use to set the rotation?
I think you can try using "Quaternion Look Rotation"
By the way you should also look into 'pooling' then instead of creating.
-
Hi djaydino,
I do not use any action to set the rotation, just create object and in it I set my "hit normal" info in "rotation" field.
I can not see any "pooling" action in PM. What do you mean?
-
Hi.
Did you try using "Quaternion Look Rotation" instead of the rotation field?
Pooling is a solution to use instead of creating and destroying (which is expensive cpu wise See this link (https://www.youtube.com/watch?v=7UswSdevSpw) for an explanation why you should use pooling.)
Pooling will create a preset amount of the object (disabled) and reuse them when needed
There are several pool asset on the asset store, but there is also a simple one on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) called 'Pooler'
Also in one of the next PlayMaker updates there will be a build in pool system included.
-
What you is to put a quaternion look rotation action before the create object action?
And in the direction I set the hit normal info then store the result. And after, in the create object action I set the result of quaternion look rotation in the rotation field of create object?
-
Ok, so I downloaded the Pooler in the ecosystem. I put the action "Quaternion Look Rotation" before the Pooler, in direction I put the "Hit Normal" of my raycast and I store the result (hitNormal, as quaternion).
Then I put a "Pooler Pool" in which I have my Bullet Hole prefab. Then a Spawn Pooler, in Position I have my Raycast hit point, but in rotation I do not really know what to put.
I tried with the Hit Normal of the raycast but it does not work.
So the Quaternion Look Rotation is useless here.
-
Hi.
After you pool the object you should store the object and then use the "Quaternion Look Rotation" with the stored object.
I looked to a c# tutorial doing this :
So he is doing a raycast,
Then instantiate (where he should pool)
Then uses the hit point + hit normal multiplied by 0.00001 (this is to set it a little bit in front of the hit position, so you wont get flickering images)
and Quaternion.LookRotation with the hit normal.
I will see if i can make a sample after the weekend.
-
thank you djaydino you are great :)
-
Hi.
Did you get it to work?
-
Hi djaydino,
nop it doesn't work :(
I can't take the stored object in the Quaternion Look Rotation.
(https://imageshack.com/a/img924/3407/1HJRKk.jpg)
-
Hi.
I tried a setup and i got it to work,
I will try to make a video tomorrow.
-
ohhh cool!
can't wait lol
-
Hi djaydino,
did you make the video? I'm so stuck :(
-
Hi.
Sorry i had to record in bits and pieces due a lot of construction work going on here.
I am editing at the moment and will try to finish it today :)
-
You do not have to say sorry lol.
Really a big thank you for helping us here and I know that sometimes we are annoying :)
But thanks again to you :)
-
Hi.
It's not one of my best video's but it explains how to do :)
-
wow thanks djaydino it works.
You win a subscriber to your youtube channel!
I use with that the "create object" action because with pooler it is so complicated for my shotgun. Indeed I have 12 raycasts in my FSM to spawn 12 bullet holes and with Pooler I will have too many states...lol
However, Is there a way to decal the object (bullet hole) a bit because it clip when it spawn on the objects?
-
Hi.
Aw i forget to show the bullet hole prefab on the video....
I have an empty object and in there i have a plane (child) with the bullet hole and i have the (i believe) z position set to 0.0001 and x rotation to 90
-
Oh yep, got it !
Thanks a lot djaydino :)
-
Hi.
You can also use an offset if needed, just add these 2 actions on the top of the 'Spawn Bullet Hole' state :
(https://i.imgur.com/flhsQREl.png)
-
Hi.
Uploaded video link with a new one (including offset info)
-
Yep I saw, I subscribed to your channel :)
-
Hi.
After you pool the object you should store the object and then use the "Quaternion Look Rotation" with the stored object.
I looked to a c# tutorial doing this :
So he is doing a raycast,
Then instantiate (where he should pool)
Then uses the hit point + hit normal multiplied by 0.00001 (this is to set it a little bit in front of the hit position, so you wont get flickering images)
and Quaternion.LookRotation with the hit normal.
I will see if i can make a sample after the weekend.
can you tell in detail which pooler should we use. is it pooler spawn. dont understand i am new.
-
where is video i cant find it bro.
-
Hi.
You can use any pool system that has playmaker support.
The Pooler Pool is on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)