Math Expression Error

Hey all

I just want to ask whether we need to add any functions in order to use the math functions like sin, tan etc. I used tand in my blueprint and seems like it is not computing the value.

It’s not being called

image

You need to connect that where you want to calculate VerticalFOV.

@ClockworkOcean I need to actually calculate it as a standalone…i mean just to calculate and use that value in another block…is there any method to calculate it and save in the variable vertical FOV

And I need the value always…like a static variable…so that I can change the VAOV and based on that vertical FOV is calculated whenever i chnage the VAOV

So you can calculate it on Begin Play?

Or put it in a function, if the other parts are going to change…

1 Like

Actually I need it also in the editor also before the play begins…i put it in a function and now it is working…Thanks for the help…

2 Likes

If you mark the function as ‘pure’ it also looks more like a ‘constant’ :slight_smile:

image

Yes i just came to know that…and another question if possible, does the world co-ordinate change in different blueprints ? I accessed the location of a blueprint component and used that location to spawn another component of another blueprint. But in the view port the content spawned at a different location. Any ideas ?

World location is constant, that’s why it’s called world.

It sounds like you’re working with relative location.

Show a bit of code if you’re unsure…

@ClockworkOcean Attaching screenshots from my case. In the first pic, i have the blueprint component camera_Front and i created an instance of the blueprint in another blueprint nmaed ‘pyramidproceduralmesh’ and using the object accessed the camera_front and get the world location. I treid to spawn it in the world location and it is not matching…

Is everything spawning at the origin perhaps? ( 0,0,0 ). Are you getting the ‘none’ error? ( after playing ).

1 Like

No, the camera component is attached to the car blueprint and it is in a random location in the world…what i am trying to do is access the world location of the camera component and spwan another component in that place…after playing no none error, the component is spawned but in another location…

Can you show the code, including the spawn?

1 Like

Hey, just made a small video which explains the case https://youtu.be/sIREzZ_NxMQ

Ok, so I see it’s printing the world location of the camera.

And you want to spawn something there? Can you show the code where you spawn?

1 Like

Basically as you see in the video i want to create a traingle starting from the location of the camera. So i use the world location of the camera as the first vertex and use the distances to find other two vertexes…i am using the procedural mesh and use the 3 vertices as input to the procedural mesh…

The traingle test fucntions returns an array of the vertices…

Yes, I get it.

Try this. In the procedural mesh code, on begin play, just spawn a sphere at the world location of the camera. It will be in the correct spot.

The reason why your procedural mesh isn’t appearing correctly, is because you’ve made a mistake in the code somewhere. I don’t see the mistake, but it must be that…

1 Like

Yes i made a sphere and it is spawing at the correct location…just made another one with all details…https://youtu.be/pNy7J0LiKCM

In the image you can see the array passing to the procedural mesh…it is the correct position of the camera

@ClockworkOcean Any take on this ?

1 Like

Hey @ClockworkOcean I think i get what is happening here…the world location of the camera is considered as a relative location while spawing in the new blueprint…so i think i have to convert the camera world location to world location in new blueprint, so that i can use it. Do you have any idea how to use the location for spawing as a world location rather than a relative location ?

World location is always world location.

I notice you’re creating the mesh at location 0,0,0. Could that have something to do with it?