weird physics bug when a ball hits the left wall

for some reason when a ball hits the left wall it gains momentum i tried using "* -1" instead of "-" heres the code y = y + vel_y x = x + vel_x vel_y = vel_y + 1 if y >= 900: y = 900 vel_y = -(vel_y – 10) if x >= 900:… Read More weird physics bug when a ball hits the left wall

Why is abs(x)+abs(y) different from sqrt(x*x + y*y)

I was making a Physics Engine in C++ when I noticed that when I replace: float absDistance = sqrt(vectorDistance.x * vectorDistance.x + vectorDistance.y * vectorDistance.y); With: float absDistance = abs(vectorDistance.x) + abs(vectorDistance.y) Different things happen. I’m using the library <cmath> I looked at a lot of stack exchanges but I couldn’t find anyone saying they’re… Read More Why is abs(x)+abs(y) different from sqrt(x*x + y*y)

Flutter Listview.Builder inside bottom sheet widget not loading data on load

The below code does not display any data when the bottomsheet loads. Once the bottomsheet is loaded if I do a save operation on the code editor it loads the data. What am I missing here? I have a bottomsheet widget which is invoked using a button. _showBottomSheet() { showModalBottomSheet( context: context, builder: (context) {… Read More Flutter Listview.Builder inside bottom sheet widget not loading data on load

How to get access to "mesh renderer" of a different object using raycast?

For example, a camera that generates Raycast and if it hits it destorys an object. public class RaycastScript : MonoBehaviour { void CheckForRaycastHit() { RaycastHit hit; //if raycast hit if(Physics.Raycast(transform.position, transform.forward, out hit)) { print(hit.collider.gameObject.name + " hit"); //print what object got hit Destroy(hit.collider.gameObject); //destroy object } } void Update() { //mouse controls camera float… Read More How to get access to "mesh renderer" of a different object using raycast?

How do I get forms inline with each other?

This probably seems like a really dumb question, but i am building a website for my school project and i need to get these two forms next to each other rather then having a line break inbetween them: <div style=”display:inline;float:left;?”> <br> <form action=”edexcel_maths.php” method=”post”> <input style=”display:inline;” type=”submit” name=”edmathsbutt” class=”button” value=”Edexcel Maths”> </form> <form action=”aqa_physics.php” method=”post”>… Read More How do I get forms inline with each other?

Python pltplot graph, show empty graph

I don’t seem to find problem why graph is not showing any lines, its just blank im new in python "Trying to plot graph maximum height and range with angle" import matplotlib.pyplot as plt import numpy as np def projectile(Vo,Angle): Acc=9.8 Mheight=(Vo**2)*np.sin(np.radians(Angle**2))/Acc**2 Range=(Vo**2)*(np.sin(np.radians(Angle)))/Acc plt.plot(int(Mheight),int(Angle)) // This is the line plt.show() // only showing blank graph… Read More Python pltplot graph, show empty graph