# Cybrosys

Member

212

186 Neutral

• Rank
Member
1. ## Simple stick physics question :)

Since i'm bored out of my mind, i descided to try and tackle physics. To write the most simplest of implementations of a sphere rolling, the rotation of the surface, cubes.. and such. But, for starters i was just thinking about a stick. Let's say it's angled at 45 degress, one end firmly on the ground. Gravity is going to push down the upper and lower part of the stick, the problem is that the lower part can't move downwards to match the upper, the upper stick is going to exhert a force down the shaft of the stick. What i'm wondering, is how much force is going to be exhert down the shaft towards the lower end of the stick? Let's say there's no friction so the other end is going to shoot sideways instead because the height force is being nullified by the ground. So, in other words: the bottom part of the stick will shoot to the side while the top end of the stick will drop to the ground. The distance between the two points can never change. So to recap, F=a*m (m = 1 for the stick), the top part is being dragged down with the force of gravity, but how much of this force is being exherted downwards through the shaft? F*dot product of the shaft vector and gravityvector? In other words, at 45 degrees -> 50%?
2. ## Calculating interception vector and time scalar

Well, thank you again. I was going insane over the problem :)
3. ## Calculating interception vector and time scalar

Thank you, you've been very helpful :) (Rate++) I'm reading through your post and checking the math, the only thing that caught my eye so far was that you stated that: VPx = (Sx + t * VTx) / t when a simpler one is: VPx = VTx + Sx / t Was there a reason for doing so?
4. ## Calculating interception vector and time scalar

Thank you for the reply. The problem is that there are 2 unknown variables, time and the DT and because of that all i could think of was to start time at almost 0 and increment it and checking how long the DP vector is. If it's less than 1 then i know we've overshot and should decrement the time with more accuracy and while it's longer than 1 continue to increment it until it's as close to 1 as we will accept. Sometimes there won't be a solution of course, depending on where the objects are and what velocities are chosen. Seeing as you seem to have a better grasp of math, did you read the other thread? Maybe we could somehow calculate the time variable if we assume that there exists a solution seeing as the ratio between the distances needed to travel is the same as the ratio between the two objects' speed.
5. ## Calculating interception vector and time scalar

What I'm trying to do is find where to, for example, shoot in order to hit a moving target. A solution may not always exist of course. I did a search on the forum and found a solution but i didn't understand his math or what it was he was calculating having variables called: a, b, c and d. The formula that i have is pretty simple, except that there's two unknowns and i don't know how to break em out, solve the equation in other words. Formula: targetPos - projectilePos + targetDir * time = projectileDir * projectileSpeed * time The variables are vectors except for the time scalar. The length of the projectileDir is 1 in the formula if the time variable was correctly chosen. The problem is i don't want to have to increment the time variable and check the length of the projectileDir to see if it's equal to about 1, and if not continue to increment and check. What my limited math skills won't allow is for me to somehow tell the formula that the |projectileDir| has to be 1 or the projectileSpeed if we want to move it out of the equation. Please help me, the search result i mentioned above refers to this post: http://www.gamedev.net/community/forums/topic.asp?topic_id=122528
6. ## D* pathfinding algorithm

There is no specific application, i was planning on implementing the algorithm as dynamically/abstract as possible for future usage.
7. ## D* pathfinding algorithm

I've just started reading about D* Lite and if possible I'll make an implementation of the algorithm plus A*. I implemented A* a long time ago and decided to implement it once again (code has a habit of disappearing) when i came across a mention of D*. I'm very curious as to your statement that each agent needs it's own copy of the map in order for the algorithm to work, so I'd love it if you could send the report you did to the email address that I've PM:ed you.
8. ## D* pathfinding algorithm

I thank everyone for their replies.
9. ## D* pathfinding algorithm

I've been trying to find some information about the D* algorithm but i haven't been able to, through google, find any information about it and/or it's implementation. I would appreciate it if anyone could post information about the algorithm and it's implementation.
10. ## [.net] Dynamically adding WebUserControls problems

Thank you for the reply! I will test what you're proposing, hopefully it will work. I seem to remember seeing other ways than my own way, to instantiate custom user controls. Though i fail to see why my original code doesn't work. It's as if it's only instantiating the Code-Behind part of the object and completely ignoring the asp.net part somehow. This might be because, opposed to for example the Button object, mine is a collection of controls. Maybe i just need to define a custom constructor for my control and somehow force the instantiation of the asp.net content... but I'm just rambling on, thank you for the help and I'll post whether or not it worked. Thank you.
11. ## [.net] Dynamically adding WebUserControls problems

I created a WebUserControl which i named NewsControl. This control consists of 2 panels, 2 labels and 1 text box. When i add the control manually to any page using <news:NewsControl ID="NewsControl1" runat="server" /> It displays and works just fine, the problem is i want to add them dynamically. I added a <asp:Table ...>..</asp:Table> to a page and in that page's Page_Load function i wrote the simple lines: List<News> news = NewsController.GetNews(); int count = 0; foreach (News entry in news) { TableRow row = new TableRow(); TableCell cell = new TableCell(); NewsControl newsControl = new NewsControl(); newsControl.ID = string.Format("NewsControl{0}", count++); cell.Controls.Add(newsControl); row.Cells.Add(cell); TableNews.Rows.Add(row); } No major complicated problems with that code, except that the NewsControl objects doesn't get drawn when i view the page! That's right, when viewing the page source code the table is empty! The code gets called without problems. If i changed my NewsControl to a simple Button instead, it gets drawn. So apparently there's something seriously wrong with asp.net, any ideas on how to get this to work?
12. ## [.net] Collections and the property window

Hi all, i'm currently trying to create a new TabControl since the one that exists is very limited. The thing is, I'm using a List<TabPage> tabPages = new List<TabPage>(); as storage for the tab pages. I've got a simple get property in the class with [Browsable(true)] so that the list is visible in the properties window. The thing is, when i add pages through the property window, they get allocated in the form but, when i click the collection in the property window later after deselecting my control, they're gone from the list, BUT, they're still in the form code. I would love it if someone please could tell me why the list gets emptied, or reallocated when the allocation of the list isn't even in the constructor but outside just to be sure. It feels as if creating a simple usercontrol requires more knowledge of all the attributes and settings in visual studio than actual coding experience :S
13. ## [.net] TcpClient rules

Does anyone know if a TcpClient's NetworkStream closes the connection if a packet fails to be delivered, that is, even if resend fails that's built-in to the tcp protocol.
14. ## [.net] C# Network/Internet programming

Yes, you are correct about the c/c++. The thing is, what if i serialize two objects and send them across the network... The TcpClient recieves the two objects, but how should it know what objects it has recieved etc? Will two *.Write calls always be handled on the server/client side as, for example, 2 BeginReadComplete events? The examples i've found has always involved someone sending a string or reading strings from a file and sending them over the network. I haven't seen any examples of actually sending "objects" over the network. The only example of that is a Remoting example but i'm worried that it's not that performance wise. Btw, does the TcpClient objects handle disconnection events, client lost etc or do i have to monitor that my self by, for example, ping messages?
15. ## [.net] C# Network/Internet programming

Well i know of the Serializable attribute, but the problem of knowing the size of an object still remains. And would remoting be a wise choice? I haven't done any test with it and just to mention it, the networking will be for a game. Nothing too fancy, just some tcp data transfers for important stuff ie client information and udp for movement packets etc.